Metadata-Version: 2.4
Name: simple-sklearn
Version: 0.1.0
Summary: Pythonic machine learning algorithms built for educational transparency and scikit-learn compatibility
Author-email: Artem Poliakov <artem4250@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://Artem259.github.io/simple-sklearn
Project-URL: Repository, https://github.com/Artem259/simple-sklearn
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: scikit-learn>=1.6.1
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.2.3
Requires-Dist: scipy>=1.13.1
Requires-Dist: typing-extensions<5.0,>=4.1.0
Provides-Extra: docs
Requires-Dist: notebook>=7.3.2; extra == "docs"
Requires-Dist: matplotlib>=3.9.4; extra == "docs"
Requires-Dist: seaborn>=0.13.2; extra == "docs"
Requires-Dist: mkdocs<2.0,>=1.6.1; extra == "docs"
Requires-Dist: mkdocs-material>=9.7.5; extra == "docs"
Requires-Dist: mkdocs-jupyter>=0.25.1; extra == "docs"
Requires-Dist: mkdocstrings-python>=2.0.3; extra == "docs"
Provides-Extra: quality
Requires-Dist: mypy>=1.19.1; extra == "quality"
Requires-Dist: pandas-stubs>=2.2.3; extra == "quality"
Requires-Dist: scipy-stubs>=1.13.1; extra == "quality"
Provides-Extra: build
Requires-Dist: build==1.4.0; extra == "build"
Requires-Dist: twine==6.2.0; extra == "build"
Requires-Dist: check-sdist==1.4.0; extra == "build"
Requires-Dist: check-wheel-contents==0.6.3; extra == "build"
Provides-Extra: test
Requires-Dist: pytest>=8.4.2; extra == "test"
Requires-Dist: pytest-cov>=6.0.0; extra == "test"
Provides-Extra: dev
Requires-Dist: pre-commit>=4.0.0; extra == "dev"
Requires-Dist: ruff==0.14.9; extra == "dev"
Dynamic: license-file

# simple-sklearn

[![CI/CD](https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml/badge.svg)][ci-cd-url]
[![codecov](https://codecov.io/gh/Artem259/simple-sklearn/graph/badge.svg)][codecov-url]
[![PyPI version](https://badge.fury.io/py/simple-sklearn.svg)][pypi-url]
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)][python-url]
[![Docs](https://img.shields.io/badge/docs-GitHub_Pages-blue.svg)][docs-url]
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][license-url]

**simple-sklearn** is a Python package designed to provide clear, readable, and highly pythonic implementations of
fundamental machine learning algorithms. Abstracting away from complex low-level optimizations, this library
focuses on clarity and educational value using high-level libraries like `numpy`, `pandas`, and `scipy`.

Every model is designed to integrate seamlessly with scikit-learn's estimator API, inheriting from
`sklearn.base.BaseEstimator` and the appropriate mixins (`ClassifierMixin` or `ClusterMixin`). This allows you
to plug these simple implementations directly into `scikit-learn` pipelines and cross-validation workflows.

**WARNING: Not for Production Use.** This library is built for educational purposes and algorithmic transparency.
The implementations prioritize readability and simplicity over execution speed and memory optimization.

---

## Available Models

**Classification:**

* OneRClassifier: 1R (One Rule) classification.
* NaiveBayesClassifier: Categorical Naive Bayes classification.
* KNeighborsClassifier: K-Nearest Neighbors classification.
* DecisionTreeClassifier: Decision Tree classification using the ID3 algorithm.

**Clustering:**

* KMeans: K-Means clustering.
* KMedoids: K-Medoids clustering.
* DBSCAN: Density-Based Spatial Clustering of Applications with Noise.
* AgglomerativeClustering: Hierarchical agglomerative clustering.

---

## Installation

**Requirements:**

* Python 3.10+

**Install directly from PyPI** using `pip`:

```bash
pip install simple-sklearn
```

Core Dependencies:

* scikit-learn (>= 1.6.1)
* numpy (>= 1.26)
* pandas (>= 2.2.3)
* scipy (>= 1.13.1)
* typing-extensions (>=4.1.0, <5.0)

---

## Quick Start

Because simple-sklearn strictly implements the scikit-learn API, you can fit and predict models exactly as you would
with scikit-learn.

### Classification Example

```python
import numpy as np
from simple_sklearn.classification import NaiveBayesClassifier

# Categorical data
X = np.array([[0, 0], [0, 1], [1, 0], [2, 2], [2, 3]])
y = np.array([0, 0, 0, 1, 1])

# Initialize and fit the model
clf = NaiveBayesClassifier()
clf.fit(X, y)

# Predict on new data
X_new = np.array([[2, 2], [1, 4]])
predictions = clf.predict(X_new)  # Handles unseen category '4' gracefully
print(f"Predictions: {predictions}")  # Output: [1 0]
```

### Clustering Example

```python
import numpy as np
from simple_sklearn.clustering import KMeans

# Continuous data
X = np.array([[0.1, 0.1], [0.2, 0.1], [10.1, 10.1], [10.2, 10.1]])

# Initialize and fit the model
clusterer = KMeans(n_clusters=2, max_iter=10, random_state=42)
clusterer.fit(X)

print(f"Cluster labels: {clusterer.labels_}")  # Output: [0 0 1 1]
print(f"Cluster centers: \n{clusterer.cluster_centers_}")  # Output: [[0.15, 0.1], [10.15, 10.1]]
```

---

## Documentation

Detailed API references, algorithm details, and Jupyter Notebook usage examples are available on the library website:

**[Artem259.github.io/simple-sklearn][docs-url]**

---

## Development & Contributing

Pull requests are welcome! If you'd like to contribute, please read the [Contributing Guide][contrib-url].

---

## Roadmap

Future development focuses on:

1. Estimator Enhancements and Performance Optimization:
    * Implementing a custom KDTree for faster nearest-neighbor searches.
    * Refactoring AgglomerativeClustering with Priority Queue (Min-Heap) to reduce time complexity
      during cluster merging.
    * Adding other estimator features (e.g., standard hyperparameters like `max_depth` for `DecisionTreeClassifier`).
2. Documentation Upgrades:
    * Configuring documentation versioning via the `mike` tool.

---

## License

This project is licensed under the [MIT License][license-url].

[ci-cd-url]: https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml
[codecov-url]: https://codecov.io/gh/Artem259/simple-sklearn
[pypi-url]: https://pypi.org/p/simple-sklearn
[python-url]: https://www.python.org/downloads/
[docs-url]: https://Artem259.github.io/simple-sklearn
[license-url]: https://github.com/Artem259/simple-sklearn/blob/main/LICENSE
[contrib-url]: https://github.com/Artem259/simple-sklearn/blob/main/CONTRIBUTING.md
