Author: Moh Rafik
This repository is part of the AI Learning Roadmap (3-Month Intensive) that includes:
- Machine Learning Basics ← (You are here)
- Deep Learning Foundations
- Generative AI Projects
This repository focuses on:
- Revisiting all ML concepts thoroughly
- Strengthening mathematical understanding
- Implementing algorithms from scratch using NumPy
- Reproducing models using scikit-learn
- Building end-to-end ML projects
| 📂 Project | 🎯 Task | 🛠️ Tech Stack | 📓 Notebook |
|---|---|---|---|
| House Prices | Regression | Scikit‑Learn, Pandas | 👉 Open |
| Flower Classification | Classification | TensorFlow, Keras | 👉 Open |
| Customer Segments | Clustering | Matplotlib, Seaborn | 👉 Open |
machine-learning-basics/notebooks/
│
├── 01_data_preprocessing/
│ ├── normalization_standardization.ipynb
│ ├── missing_values_handling.ipynb
│ ├── feature_scaling.ipynb
│
├── 02_supervised_learning/
│ ├── linear_regression_numpy.ipynb
│ ├── logistic_regression_numpy.ipynb
│ ├── decision_trees_random_forests.ipynb
│ ├── svm_knn.ipynb
│
├── 03_unsupervised_learning/
│ ├── kmeans_clustering.ipynb
│ ├── pca_visualization.ipynb
│ ├── hierarchical_clustering.ipynb
│
├── 04_model_evaluation/
│ ├── model_metrics_examples.ipynb
│ ├── cross_validation.ipynb
│
├── projects/
│ ├── house_price_prediction.ipynb
│ ├── iris_classification.ipynb
│ ├── customer_segmentation.ipynb
│ ├── flower_type_classification.ipynb
│
│
├── assets/
│ ├── images/
│ └── figures/
│
└── README.md
| Week | Focus | Topics |
|---|---|---|
| 1 | Foundations | Math (Linear Algebra, Stats, Gradient Descent), Preprocessing |
| 2 | Regression Models | Linear, Logistic, Polynomial Regression, Regularization |
| 3 | Classification | Decision Trees, Random Forests, KNN, SVM |
| 4 | Clustering & PCA | K-Means, Hierarchical Clustering, PCA, Project Showcase |
- Definition: ML enables computers to learn from data without explicit programming.
- Categories: Supervised, Unsupervised, Semi-supervised, Reinforcement Learning.
- Mathematical Backbone:
- Linear Algebra (vectors, dot products, matrix operations)
- Probability & Statistics (mean, variance, conditional probability, Bayes theorem)
- Calculus (gradients, partial derivatives)
- Optimization (gradient descent, cost minimization)
- Linear Regression: Predict continuous values using least squares.
- Formula: ( \hat{y} = wX + b )
- Goal: Minimize Mean Squared Error (MSE).
- Logistic Regression: Classification using the sigmoid function.
- Output: Probability between [0,1]
- Loss: Binary cross-entropy.
- Decision Trees: Hierarchical partitioning of data based on feature splits.
- Random Forest: Ensemble of multiple trees (reduces overfitting).
- SVM: Finds optimal separating hyperplane maximizing margin.
- K-Means Clustering: Groups data points based on distance to cluster centroids.
- PCA (Principal Component Analysis): Dimensionality reduction via eigen decomposition.
- Hierarchical Clustering: Builds tree (dendrogram) of nested clusters.
- Metrics: Accuracy, Precision, Recall, F1-score, ROC-AUC.
- Bias-Variance Tradeoff: Balance between underfitting and overfitting.
- Cross-Validation: K-fold evaluation for robustness.
NumPy– for mathematical operationsPandas– for data handlingMatplotlib / Seaborn– for visualizationsscikit-learn– for quick model building and comparison
- Data preprocessing
- Feature engineering
- Train-test split
- Model training and tuning
- Evaluation and visualization
Each notebook demonstrates:
- Step-by-step explanation with comments
- Plots for decision boundaries and loss curves
- Comparison between “from-scratch” and scikit-learn results
Goal: Predict house prices based on numerical and categorical features.
Concepts: Linear Regression, Feature Scaling, Evaluation Metrics
Dataset: Boston Housing Dataset
Deliverables:
- Data cleaning notebook
- Regression model implementation
- Evaluation report (MSE, R²)
Goal: Classify iris flowers into species using petal/sepal features.
Concepts: Logistic Regression, Decision Trees, Random Forest
Dataset: Iris Dataset (UCI Repository)
Deliverables:
- Visualization of data distribution
- Model comparison notebook
- Decision boundaries plot
Goal: Cluster customers based on spending behavior.
Concepts: K-Means, PCA visualization, Elbow Method
Dataset: Mall Customers Dataset
Deliverables:
- Clustering notebook
- PCA-based 2D visualization
- Business insights summary
| Model | Accuracy | Notes |
|---|---|---|
| Linear Regression | 92% | Well-fitted, low MSE |
| Logistic Regression | 95% | Effective for binary classes |
| Random Forest | 97% | Best overall performance |
| K-Means (k=3) | N/A | 3 well-separated clusters |
- Developed deep mathematical understanding of core ML algorithms.
- Learned how to balance bias–variance via tuning.
- Understood importance of preprocessing and feature scaling.
- Built reproducible ML pipelines and evaluation frameworks.
➡️ Proceed to the Deep Learning Foundations repository
to explore Neural Networks, CNNs, RNNs, and Transformers.
- Python 3.9+
- Jupyter Notebook / VS Code
- Libraries:
numpy,pandas,matplotlib,scikit-learn,seaborn
- Aurélien Géron — Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow
- MIT OCW — 6.036 Introduction to Machine Learning
- scikit-learn documentation: https://scikit-learn.org
- UCI Machine Learning Repository
📌 Maintained by Moh Rafik
💬 For queries or collaborations: [RAFIKIITBHU@GMAIL.COM or LinkedIn]