# Machine Learning Topics in Python-100-Days: Complete Day 81-90 Curriculum

> Explore machine learning topics in Python-100-Days including supervised learning, clustering, neural networks, and a Titanic project. Master ML concepts in 10 days.

- Repository: [骆昊/Python-100-Days](https://github.com/jackfrued/Python-100-Days)
- Tags: tutorial
- Published: 2026-02-24

---

**The Python-100-Days repository by jackfrued dedicates Days 81 through 90 exclusively to machine learning, covering supervised algorithms, unsupervised clustering, ensemble methods, neural networks, and an end-to-end Titanic classification project.**

The **jackfrued/Python-100-Days** repository structures its machine learning curriculum as a sequential ten-day module (Day 81-90) within the broader 100-day Python learning path. Each day is presented as a self-contained Markdown file with embedded code blocks, requiring only **NumPy**, **pandas**, **scikit-learn**, and **matplotlib** to run the examples.

## The Day 81-90 Machine Learning Roadmap

The curriculum follows a pedagogical progression from theoretical foundations to production-ready implementations:

1. **Day 81: Machine Learning Overview** (`Day81-90/81.浅谈机器学习.md`) — Introduces the AI-to-ML hierarchy, workflow stages (problem definition → data → model → evaluation → deployment), and a "first ML" example.

2. **Day 82: k-Nearest Neighbors** (`Day81-90/82.k最近邻算法.md`) — Covers distance metrics (Euclidean, Manhattan), data splitting strategies, and dual implementations using pure **NumPy** and **scikit-learn**'s `KNeighborsClassifier`.

3. **Day 83: Decision Trees & Random Forest** (`Day81-90/83.决策树和随机森林.md`) — Explains tree construction, impurity measures (Gini, Entropy), pruning techniques, and ensemble averaging via `RandomForestClassifier`.

4. **Day 84: Naive Bayes** (`Day81-90/84.朴素贝叶斯算法.md`) — Implements Gaussian and Multinomial Naive Bayes from scratch and via scikit-learn, emphasizing Bayes' theorem and conditional independence.

5. **Day 85: Regression Models** (`Day81-90/85.回归模型.md`) — Covers linear regression, regularized variants (**Ridge**, **Lasso**, **SGD**), polynomial expansion, and logistic regression with associated evaluation metrics (MSE, R²).

6. **Day 86: K-Means Clustering** (`Day81-90/86.K-Means聚类算法.md`) — Unsupervised learning focus: algorithmic steps, centroid initialization, inertia calculation, and visualization of cluster boundaries.

7. **Day 87: Ensemble Learning** (`Day81-90/87.集成学习算法.md`) — Advanced ensemble techniques including **AdaBoost**, **Gradient Boosted Decision Trees (GBDT)**, **XGBoost**, and **LightGBM** with boosting theory.

8. **Day 88: Neural Network Models** (`Day81-90/88.神经网络模型.md`) — Multilayer perceptrons (MLP), activation functions, forward/back-propagation mathematics, and implementation using `MLPClassifier`.

9. **Day 89: Natural Language Processing** (`Day81-90/89.自然语言处理入门.md`) — Text preprocessing, bag-of-words, **TF-IDF**, **word2vec** with gensim, and transformer architecture overviews.

10. **Day 90: Machine Learning Practice** (`Day81-90/90.机器学习实战.md`) — Capstone **Titanic Kaggle project**: data exploration, feature engineering, pipeline construction, model training (logistic regression and tree ensembles), and submission generation.

## Core Algorithms and Implementation Details

### Supervised Learning Foundations (Days 82-85)

The repository emphasizes **dual implementation** pedagogy: each algorithm is first built with pure NumPy to reveal mathematical mechanics, then replaced with optimized scikit-learn production code.

For **k-Nearest Neighbors** in `82.k最近邻算法.md`, the curriculum demonstrates distance metric calculation manually before introducing scikit-learn's vectorized approach:

```python
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report

knn = KNeighborsClassifier(n_neighbors=5)
knn.fit(X_train, y_train)
print(classification_report(y_test, knn.predict(X_test)))

```

**Decision Trees** (Day 83) detail impurity reduction via information gain and Gini index, culminating in `RandomForestClassifier` hyperparameter tuning for `n_estimators` and `max_depth`.

### Regression and Regularization (Day 85)

`85.回归模型.md` distinguishes between continuous target regression and classification. It implements **Ridge** (L2) and **Lasso** (L1) regularization to combat overfitting:

```python
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error

ridge = Ridge(alpha=1.0)
ridge.fit(X_train, y_train)
print("Ridge MSE:", mean_squared_error(y_test, ridge.predict(X_test)))

```

### Unsupervised and Ensemble Methods (Days 86-87)

**K-Means clustering** (Day 86) is implemented with explicit centroid update loops before demonstrating `sklearn.cluster.KMeans`. The **ensemble** day (Day 87) bridges from AdaBoost's sequential weighting to modern gradient boosting libraries (XGBoost, LightGBM), explaining bias-variance trade-offs in stacked learners.

### Neural Networks and NLP (Days 88-89)

Day 88 restricts neural coverage to shallow **MLP** architectures using `MLPClassifier` with configurable `hidden_layer_sizes` and `max_iter`, avoiding deep learning frameworks to maintain focus on backpropagation fundamentals. Day 89 transitions to **NLP** with `CountVectorizer`, `TfidfTransformer`, and gensim's `Word2Vec`, concluding with transformer self-attention concepts.

## End-to-End Project: Titanic Survival Prediction

The curriculum culminates in `90.机器学习实战.md` with a complete **machine learning pipeline** using the Titanic dataset. The example demonstrates:

- **Data ingestion** with pandas `read_csv`
- **Preprocessing pipelines** via `ColumnTransformer` combining `SimpleImputer`, `StandardScaler`, and `OneHotEncoder`
- **Model chaining** with `Pipeline` objects wrapping preprocessing and `LogisticRegression`
- **Evaluation metrics** and CSV submission generation

```python
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LogisticRegression

numeric_features = ["Age", "Fare", "SibSp", "Parch"]
numeric_transformer = Pipeline([
    ("imputer", SimpleImputer(strategy="median")),
    ("scaler", StandardScaler())
])

categorical_features = ["Sex", "Embarked", "Pclass"]
categorical_transformer = Pipeline([
    ("imputer", SimpleImputer(strategy="most_frequent")),
    ("onehot", OneHotEncoder(handle_unknown="ignore"))
])

preprocess = ColumnTransformer([
    ("num", numeric_transformer, numeric_features),
    ("cat", categorical_transformer, categorical_features)
])

clf = Pipeline([
    ("preprocess", preprocess),
    ("model", LogisticRegression(max_iter=200))
])
clf.fit(X_train, y_train)

```

## Summary

- The **Day 81-90** section in Python-100-Days provides a comprehensive machine learning curriculum spanning ten consecutive tutorials.
- Topics progress from **k-NN** and **decision trees** through **ensemble methods** and **neural networks**, concluding with **NLP** and a **Titanic capstone project**.
- Every algorithm includes both **mathematical explanations** and **runnable scikit-learn code** stored in the `Day81-90/` directory.
- The repository requires only standard scientific Python libraries (NumPy, pandas, scikit-learn, matplotlib) to execute all examples.

## Frequently Asked Questions

### Does Python-100-Days cover deep learning or only classical machine learning?

The repository focuses primarily on classical machine learning through Day 88, which introduces shallow **multilayer perceptrons** using scikit-learn's `MLPClassifier`. While Day 89 mentions transformer architectures conceptually, deep learning frameworks like PyTorch or TensorFlow are not used; the emphasis remains on foundational algorithms and scikit-learn implementations.

### What Python libraries are required for the machine learning section?

According to the repository's [`requirements.txt`](https://github.com/jackfrued/Python-100-Days/blob/main/requirements.txt) and source code analysis, the Day 81-90 content depends on **NumPy** for numerical operations, **pandas** for data manipulation, **scikit-learn** for algorithm implementations and model evaluation, and **matplotlib** for visualization. Optional dependencies include **gensim** for word2vec demonstrations in Day 89.

### Is the machine learning content suitable for beginners?

Yes. Day 81 explicitly introduces **machine learning workflow fundamentals** (problem definition, data collection, feature engineering, model selection, evaluation) before any code implementation. Subsequent days provide **dual implementations**—first in pure NumPy to explain the mathematics, then in scikit-learn—making the material accessible to learners transitioning from basic Python to data science.

### Does the curriculum include real-world projects or only algorithm theory?

The repository includes both theoretical explanations and practical application. While Days 82-89 focus on individual algorithm mechanics using standard datasets like Iris, **Day 90** provides a complete **end-to-end machine learning project** using the Titanic dataset, covering data cleaning, feature engineering, pipeline construction, and Kaggle submission generation.