Metadata-Version: 2.4
Name: sahilai
Version: 0.2.0
Summary: A beginner-friendly machine-learning framework that explains the math.
Author: Sahil Khan
License: MIT
Keywords: AI,machine-learning,education,linear-regression
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# SahilAI v0.2.0

**Learn machine learning by using it and understanding the mathematics behind it.**

SahilAI is an early educational machine-learning framework by Sahil Khan. It is designed so students can import algorithms in Python, train them, and explore the calculations step by step.

## Installation from source

Requires Python 3.10 or newer.

```bash
python -m pip install -e .
```

## Import your own algorithms

```python
from sahilai.linear_model import EasyLearn, ComplexLearning

X = [[1], [2], [3], [4], [5]]
y = [20, 30, 40, 50, 60]

# EasyLearn: closed-form least-squares solution, explained simply
easy = EasyLearn()
easy.fit(X, y)
print(easy.predict([[6]]))

# ComplexLearning: gradient-descent version, with training history
complex_model = ComplexLearning(learning_rate=0.01, epochs=5000)
complex_model.fit(X, y, verbose=True)
print(complex_model.predict([[6]]))
print(complex_model.loss_history_[-1])
```

These two classes are educational implementations, not production replacements for scikit-learn. This first version supports one numerical feature.

## Terminal learning commands

```bash
sahilai start
sahilai lesson 1
sahilai lesson 2
sahilai lesson 3
sahilai demo linear
```

## Mathematical details

Both models use the linear equation:

    prediction = weight * x + bias

`EasyLearn` computes the least-squares solution directly using the closed-form equations for a one-feature linear regression.

`ComplexLearning` optimizes mean squared error with gradient descent:

    MSE = (1/n) * sum((prediction - target)^2)
    dMSE/dw = (2/n) * sum((prediction - target) * x)
    dMSE/db = (2/n) * sum(prediction - target)

Parameter update:

    parameter = parameter - learning_rate * gradient

## Tests

```bash
python -m unittest discover -s tests -v
```

## Roadmap

1. More lessons and interactive exercises
2. Multiple input features
3. Classification algorithms
4. Tensors and neural-network layers
5. Backpropagation and deep learning
6. Documentation and a public PyPI release

## License

MIT.
