HomeGallery

// DATA_SCIENCE

DATA SCIENCE

[MINOR]

// PROJECTS

Data Mining: Prediction & Classification

FEATURED

Data Mining: Prediction & Classification

01 / 02

// ALL_WORK

Data Mining: Prediction & Classification

01 / PROJECT

Data Mining: Prediction & Classification

R assignment building prediction and classification models for property valuation and wheat variety identification, using linear regression, decision trees, and random forests.

// FEATURES

  • Property price prediction via linear regression, stepwise AIC reduction, decision tree, and random forest
  • RMSE comparison across all four models to select the best predictor
  • Wheat variety classification across three varieties (Canadian, Kama, Rosa)
  • LDA assumption checking: multicollinearity, multivariate normality, and homogeneity of covariance
  • ROC curve comparison across LDA, two decision tree variants, and random forest
  • Outlier detection and removal via ggpairs and jitter facet plots
  • Decision tree visualised with rpart.plot to extract key differentiating splits
  • Final CSVs exported with .pred / .pred_class columns appended to test data

// CHALLENGES

LDA assumptions failed on wheat data despite visually linear class separation

Multicollinearity in size features (length, width, perimeter) and heterogeneous covariances ruled out LDA, multinomial logistic, and Naive Bayes. random forest used instead

Rushed straight into modelling without exploratory analysis on the property dataset

Iterated across four model types and compared RMSE empirically; random forest won with lowest training RMSE

Namespace conflict between stats::step and tidymodels step functions

Resolved with explicit stats:: namespace prefix, mirroring C++ scope resolution

RtidymodelsrandomForesttidyverseData Mining
VIEW_→

02 / PROJECT

Football Analytics: PL vs La Liga

Group data science project scraping 3 seasons of team statistics from FBref across the Premier League and La Liga, using regression and classification models to analyse and predict team performance metrics.

// FEATURES

  • Selenium + BeautifulSoup scraper pulling 6 stat categories (keeper, shooting, passing, shot creation, possession, playtime) across 3 seasons from FBref
  • Data pipeline: column renaming, one-hot encoding, multi-season concatenation, and CSV export for reproducibility
  • Polynomial regression (n=1-3) with residual analysis to predict goalkeeper kick attempts from crosses faced
  • Naive Bayes league classifier with Stratified k-Fold CV and Platt Scaling calibration. Reducing overconfidence in predicted probabilities
  • KNN regressor vs linear/polynomial regression comparison with R² and RMSE sweep across k values
  • Random Forest classifier and regressor benchmarked against polynomial and KNN models
  • OLS regression on shooting data: shots on target and distance explain 82% of goal variance
  • Three-way classification comparison (Logistic Regression, Random Forest, Naive Bayes) on possession and playtime features. Playtime features achieved 96% accuracy with Logistic Regression

// CHALLENGES

FBref renders tables dynamically, requests alone returned empty pages

Switched to headless Selenium with a 5-second render wait before passing the page source to BeautifulSoup

Naive Bayes overconfident at probability extremes (over-predicting below 0.4, under-predicting around 0.5 and 0.8)

Applied Platt Scaling via logistic regression on log-odds, aligning predicted probabilities with true class frequencies and lowering Brier score

A numeric column consistently returned NaN on pd.to_numeric despite appearing valid

Diagnosed as hidden whitespace; stripped and dropped the column since it contained no discriminating information

PythonSeleniumBeautifulSoupscikit-learnpandasstatsmodels
VIEW_→