Python Machine Learning

From your first model to a deployed one. These 31 tutorials cover preprocessing, feature engineering, regression, decision trees, random forests, XGBoost, SVMs, clustering, PCA, model evaluation, hyperparameter tuning, and deployment, all with scikit-learn. The series wraps with a full house price prediction project.

ML: Train/Test Split & Cross-Validation

Test a model on the rows it trained on and it will flatter itself every time. A train test split in Python fixes that: hide a slice of the data, train on the rest, and let the hidden slice deliver the only score you can trust. This guide covers the basic split, stratification, K-Fold cross-validation, and the three-way validation setup, all with runnable scikit-learn code. “Testing on your training data is like grading your own exam. You will always think ... Read More

ML: Linear Regression, Theory and Implementation

Linear regression draws the best-fitting straight line through your data. This linear regression Python guide takes you from the math behind that line, to gradient descent written from scratch, to scikit-learn’s LinearRegression, R-squared, residual analysis, and multiple regression on real data. “All models are wrong, but some are useful.” George Box, statistician Last Updated: July 2026 | Tested on: Python 3.14.6, scikit-learn 1.9.0, NumPy 2.4.6, pandas 2.3.3 | Difficulty: Intermediate | Reading Time: 20 minutes Here is the whole idea ... Read More

ML: Polynomial & Regularization (Ridge, Lasso)

You build a model, it nails every point in your training data, then it falls apart the moment fresh numbers show up. That gap between the practice test and the real exam is exactly what ridge lasso regression is built to close. This guide starts with polynomial regression for curved data, then leans on Ridge (L2) and Lasso (L1) to rein in that overfitting, with every example run on scikit-learn. “The art of statistical learning is finding the right level ... Read More