Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

42AI — Machine Learning from Scratch

A collection of machine learning projects developed as part of the 42 School AI curriculum. Each project implements a core algorithm from scratch, without relying on ML libraries for the model itself — only standard numerical and data-handling tools (NumPy, pandas) are used.


Projects

Project Algorithm Task Key Metric
LinearRegression Univariate linear regression Predict car price from mileage R-squared: 73.30%
DSLR Logistic regression (One-vs-All) Classify Hogwarts students into houses Test accuracy: 99.00%

LinearRegression

Predicting used car prices from mileage using batch gradient descent. The model learns two parameters (bias and slope) on a 24-sample dataset, with min-max normalization, early stopping, and parameter persistence to JSON.

Detail Value
Type Regression
Features 1 (mileage)
Optimization Batch gradient descent with early stopping
R-squared 73.30%
Language Python 3.13

See the full documentation in LinearRegression/README.md.


DSLR

Multiclass classification of Hogwarts students into four houses based on course grades. Implements binary logistic regression with a One-vs-All strategy, along with a full data analysis pipeline: reimplemented describe(), histogram, scatter plot, and pair plot.

Detail Value
Type Classification (4-class)
Features 10 / 13 courses (after feature selection)
Optimization Mini-batch SGD with momentum, L2 regularization, early stopping
Training accuracy 98.19%
Test accuracy 99.00%
Language Python 3.13

See the full documentation in DSLR/README.md.


Technology

All projects share a common approach:

  • No ML libraries for model implementation — gradient descent, loss functions, scalers, and imputers are written from scratch
  • NumPy for vectorized array operations
  • pandas for data loading
  • matplotlib for visualization
  • Python >= 3.13, managed with uv

Each project is self-contained with its own pyproject.toml and dependencies. To get started with any project:

cd <project_directory>
uv sync

License

These projects were developed as part of the 42 School curriculum (42AI branch).

About

AI/ML Projects from 42 School

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages