I built 15 small Python projects to practise the maths behind data science. Each includes simple code and a visual.
See the project guide for the formulas, methods, and results.
If this helps you learn, please ⭐ the repo!
| # | Project | What you will explore | Notebook |
|---|---|---|---|
| 01 | Linear Regression From Scratch | Least squares, slope, intercept, and prediction errors | Open |
| 02 | Gradient Descent Visualizer | Derivatives, learning rate, and optimization steps | Open |
| 03 | PCA From Scratch | Covariance, eigenvectors, and dimensionality reduction | Open |
| 04 | Statistical A/B Testing Engine | Conversion rates, z-scores, and p-values | Open |
| 05 | Bayesian A/B Testing | Bayes' rule, Beta distributions, and posterior probability | Open |
| 06 | Customer Churn Probability | Logistic probabilities and simple customer features | Open |
| 07 | Time-Series Forecasting | Trend, seasonality, moving averages, and forecasts | Open |
| 08 | Portfolio Optimization | Covariance, risk, return, and asset mixes | Open |
| 09 | Matrix Factorization Recommender | Low-rank factors and missing-rating predictions | Open |
| 10 | Clustering From Scratch | Distance, cluster centers, and k-means | Open |
| 11 | Logistic Regression From Scratch | Sigmoid, gradients, and decision boundaries | Open |
| 12 | Naive Bayes From Scratch | Conditional probability and word-count classification | Open |
| 13 | Monte Carlo Simulation Lab | Random sampling, area, and an estimate of pi | Open |
| 14 | Probability Anomaly Detection | Mean, standard deviation, and z-score flags | Open |
| 15 | Dynamic Pricing Optimization | Demand curves, revenue, and grid search | Open |
Open any .ipynb file in Jupyter Notebook, JupyterLab, or Visual Studio Code. The explanation and visualization preview are saved in the notebook, so you can browse the project before running its code.
-
Install Python 3.
-
Install the libraries used in the projects:
python -m pip install numpy matplotlib
-
Open a project folder and run its script. For example:
cd 01_linear_regression python main.pyOr open that folder's notebook and run the cells from top to bottom.
The scripts print key results and save generated charts in each project's output/ folder. The notebooks display charts inline. Random examples use fixed seeds where needed, so the results are repeatable.
01_linear_regression/
├── 01_linear_regression.ipynb # Explanation, code, and visualization preview
├── main.py # Standalone Python version
├── README.md # Short project guide
└── output/ # Chart created when main.py is run
- Start with a small example. The data is intentionally compact and easy to inspect.
- Keep the math visible. The code uses straightforward formulas and named steps.
- Learn by changing things. Try different sample values, learning rates, or model settings and observe what changes.
- Build intuition first. These projects are practice exercises, not optimized software packages.
- Python
- NumPy
- Matplotlib
- Jupyter notebooks
The datasets are small teaching examples, not real customer, experiment, or market data. Statistical results are simplified for learning. The portfolio example is not investment advice, and the pricing and churn examples should not be used to make real business decisions.