simple-sklearn 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. simple_sklearn-0.1.0/CHANGELOG.md +6 -0
  2. simple_sklearn-0.1.0/CONTRIBUTING.md +156 -0
  3. simple_sklearn-0.1.0/LICENSE +21 -0
  4. simple_sklearn-0.1.0/PKG-INFO +199 -0
  5. simple_sklearn-0.1.0/README.md +145 -0
  6. simple_sklearn-0.1.0/data/README.md +24 -0
  7. simple_sklearn-0.1.0/data/classification_4f.csv +11 -0
  8. simple_sklearn-0.1.0/data/clustering_2f.csv +11 -0
  9. simple_sklearn-0.1.0/pyproject.toml +175 -0
  10. simple_sklearn-0.1.0/setup.cfg +4 -0
  11. simple_sklearn-0.1.0/src/simple_sklearn/__init__.py +25 -0
  12. simple_sklearn-0.1.0/src/simple_sklearn/_version.py +24 -0
  13. simple_sklearn-0.1.0/src/simple_sklearn/classification/__init__.py +28 -0
  14. simple_sklearn-0.1.0/src/simple_sklearn/classification/_decision_tree.py +210 -0
  15. simple_sklearn-0.1.0/src/simple_sklearn/classification/_k_neighbors.py +220 -0
  16. simple_sklearn-0.1.0/src/simple_sklearn/classification/_naive_bayes.py +185 -0
  17. simple_sklearn-0.1.0/src/simple_sklearn/classification/_one_r.py +104 -0
  18. simple_sklearn-0.1.0/src/simple_sklearn/classification/tree_structure.py +10 -0
  19. simple_sklearn-0.1.0/src/simple_sklearn/clustering/__init__.py +28 -0
  20. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_agglomerative.py +256 -0
  21. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_base_partitional.py +215 -0
  22. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_dbscan.py +170 -0
  23. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_k_means.py +112 -0
  24. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_k_medoids.py +153 -0
  25. simple_sklearn-0.1.0/src/simple_sklearn/clustering/_tools.py +95 -0
  26. simple_sklearn-0.1.0/src/simple_sklearn/py.typed +0 -0
  27. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/PKG-INFO +199 -0
  28. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/SOURCES.txt +49 -0
  29. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/dependency_links.txt +1 -0
  30. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/requires.txt +33 -0
  31. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/scm_file_list.json +45 -0
  32. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/scm_version.json +8 -0
  33. simple_sklearn-0.1.0/src/simple_sklearn.egg-info/top_level.txt +1 -0
  34. simple_sklearn-0.1.0/tests/__init__.py +0 -0
  35. simple_sklearn-0.1.0/tests/classification/__init__.py +0 -0
  36. simple_sklearn-0.1.0/tests/classification/conftest.py +16 -0
  37. simple_sklearn-0.1.0/tests/classification/test_decision_tree.py +78 -0
  38. simple_sklearn-0.1.0/tests/classification/test_kneighbors.py +140 -0
  39. simple_sklearn-0.1.0/tests/classification/test_naive_bayes.py +136 -0
  40. simple_sklearn-0.1.0/tests/classification/test_one_r.py +61 -0
  41. simple_sklearn-0.1.0/tests/classification/testing_utils.py +23 -0
  42. simple_sklearn-0.1.0/tests/clustering/__init__.py +0 -0
  43. simple_sklearn-0.1.0/tests/clustering/conftest.py +14 -0
  44. simple_sklearn-0.1.0/tests/clustering/test_agglomerative.py +114 -0
  45. simple_sklearn-0.1.0/tests/clustering/test_dbscan.py +107 -0
  46. simple_sklearn-0.1.0/tests/clustering/test_k_means.py +160 -0
  47. simple_sklearn-0.1.0/tests/clustering/test_k_medoids.py +144 -0
  48. simple_sklearn-0.1.0/tests/clustering/testing_utils.py +9 -0
  49. simple_sklearn-0.1.0/tests/test_sklearn_compatibility.py +34 -0
  50. simple_sklearn-0.1.0/tests/test_version.py +30 -0
  51. simple_sklearn-0.1.0/tests/testing_utils.py +90 -0
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-07-15)
4
+
5
+
6
+ * Initial release
@@ -0,0 +1,156 @@
1
+ # Contributing to simple-sklearn
2
+
3
+ [![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
4
+ [![Typing](https://img.shields.io/pypi/types/simple-sklearn)](https://pypi.org/p/simple-sklearn)
5
+
6
+ First off, thank you for considering contributing to **simple-sklearn**!
7
+
8
+ Before starting work on a major feature or architectural change, please open an issue to discuss it.
9
+ This ensures your approach aligns with the project's roadmap and prevents wasted effort.
10
+
11
+ ---
12
+
13
+ ## Conventional Commits
14
+
15
+ This repository uses [Release Please](https://github.com/googleapis/release-please) to automate
16
+ changelog generation and GitHub releases.
17
+
18
+ Because of this, **all Pull Request titles must follow the
19
+ [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.**
20
+
21
+ * Example feature: `feat: implement KDTree for neighbors search`
22
+ * Example bug fix: `fix(dbscan): resolve zero-division error`
23
+ * Example docs: `docs: update roadmap in README`
24
+
25
+ If your PR does not follow this structure, the automated CI/CD pipeline will fail to interpret
26
+ the changes for semantic versioning.
27
+
28
+ ---
29
+
30
+ ## Development Setup
31
+
32
+ ### Prerequisites
33
+
34
+ * Python 3.10 or higher
35
+ * Git
36
+
37
+ ### Workflow
38
+
39
+ The project uses a Makefile to simplify development workflows.
40
+
41
+ *Note for Windows users: the `make` tool is not natively installed on Windows, but manual fallback commands
42
+ are provided below.*
43
+
44
+ 1. **Fork and clone the repository:**
45
+
46
+ Click the "Fork" button at the top right of the repository page, then clone your fork locally:
47
+
48
+ ```bash
49
+ git clone https://github.com/<YOUR-USERNAME>/simple-sklearn.git
50
+ cd simple-sklearn
51
+ ```
52
+
53
+ 2. **Add the upstream remote:**
54
+
55
+ This allows you to keep your fork synced with the main repository:
56
+
57
+ ```bash
58
+ git remote add upstream https://github.com/Artem259/simple-sklearn.git
59
+ ```
60
+
61
+ 3. **Create a feature branch:**
62
+
63
+ Always create a new branch for your work rather than committing to `main`:
64
+
65
+ ```bash
66
+ git checkout -b feat/my-new-feature
67
+ ```
68
+
69
+ 4. **Create and activate a virtual environment:**
70
+
71
+ ```bash
72
+ python -m venv .venv
73
+
74
+ # On Linux/macOS:
75
+ source .venv/bin/activate
76
+
77
+ # On Windows:
78
+ .venv\Scripts\activate
79
+ ```
80
+
81
+ 5. **Install Dependencies:**
82
+
83
+ **Using `make` (Linux/macOS):**
84
+
85
+ This command installs the package in editable mode along with all necessary dev dependencies,
86
+ and sets up the `pre-commit` hooks.
87
+
88
+ ```bash
89
+ make setup
90
+ ```
91
+
92
+ **Manual commands (Windows):**
93
+
94
+ ```bash
95
+ python -m pip install --upgrade pip
96
+ python -m pip install -e ".[docs,quality,build,test,dev]"
97
+ pre-commit install
98
+ ```
99
+
100
+ 6. **Run checks and tests:**
101
+
102
+ The project uses `ruff` for formatting/linting, `mypy` for static type checking, and `pytest` for testing.
103
+
104
+ ```bash
105
+ make lint # Runs pre-commit checks across all files
106
+ make test # Runs the pytest suite
107
+ make test-cov # Runs the pytest suite and generates a coverage report
108
+ make check # Runs linting, build verification (sdist/wheel), and tests sequentially
109
+ ```
110
+
111
+ You can also run `pytest` and `pre-commit run --all-files` manually.
112
+
113
+ 7. **Local CI/CD Simulation (Optional):**
114
+
115
+ If you have [act](https://nektosact.com/) installed locally, you can simulate the GitHub Actions pipeline
116
+ before opening a PR:
117
+
118
+ ```bash
119
+ make act-pr # Simulates the pull-request workflow locally
120
+ ```
121
+
122
+ 8. **Build documentation locally:**
123
+
124
+ The project uses `mkdocs` with the `mkdocs-jupyter` plugin for demo Jupyter notebooks.
125
+
126
+ ```bash
127
+ make docs # Preview documentation with live-reloading (no notebook execution)
128
+ make docs-build # Build and verify documentation
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Coding Standards & Guidelines
134
+
135
+ To maintain the quality of code and architecture of simple-sklearn, please adhere to the following:
136
+
137
+ * **Scikit-learn Compatibility:** Any new estimator must inherit from `BaseEstimator`, the appropriate mixin
138
+ (`ClassifierMixin`/`ClusterMixin`), and successfully pass `sklearn.utils.estimator_checks`.
139
+ * **Type Hinting:** The project utilizes strict `mypy` typing. Ensure all function signatures and
140
+ class attributes are appropriately type-hinted.
141
+ * **Docstrings:** Use **Google-style docstrings**. This is strictly required so that `mkdocstrings`
142
+ can correctly generate the API reference documentation.
143
+
144
+ ---
145
+
146
+ ## Submitting Your Pull Request
147
+
148
+ Before submitting your PR, please ensure you have completed the following checklist:
149
+
150
+ * [ ] I have fetched the latest changes from `upstream/main` and rebased my branch if necessary.
151
+ * [ ] My PR is narrowly scoped to address a single feature or bug fix.
152
+ * [ ] `make check` and `make docs-build` (or the equivalent manual commands) pass locally without errors.
153
+ * [ ] I have added or updated tests for my changes, and my changes do not decrease overall test coverage.
154
+ * [ ] I have successfully run scikit-learn estimator checks against any new estimators.
155
+ * [ ] I have updated the docstrings and documentation if my changes affect the API.
156
+ * [ ] My PR title follows the Conventional Commits specification.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Artem Poliakov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: simple-sklearn
3
+ Version: 0.1.0
4
+ Summary: Pythonic machine learning algorithms built for educational transparency and scikit-learn compatibility
5
+ Author-email: Artem Poliakov <artem4250@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://Artem259.github.io/simple-sklearn
8
+ Project-URL: Repository, https://github.com/Artem259/simple-sklearn
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: scikit-learn>=1.6.1
26
+ Requires-Dist: numpy>=1.26
27
+ Requires-Dist: pandas>=2.2.3
28
+ Requires-Dist: scipy>=1.13.1
29
+ Requires-Dist: typing-extensions<5.0,>=4.1.0
30
+ Provides-Extra: docs
31
+ Requires-Dist: notebook>=7.3.2; extra == "docs"
32
+ Requires-Dist: matplotlib>=3.9.4; extra == "docs"
33
+ Requires-Dist: seaborn>=0.13.2; extra == "docs"
34
+ Requires-Dist: mkdocs<2.0,>=1.6.1; extra == "docs"
35
+ Requires-Dist: mkdocs-material>=9.7.5; extra == "docs"
36
+ Requires-Dist: mkdocs-jupyter>=0.25.1; extra == "docs"
37
+ Requires-Dist: mkdocstrings-python>=2.0.3; extra == "docs"
38
+ Provides-Extra: quality
39
+ Requires-Dist: mypy>=1.19.1; extra == "quality"
40
+ Requires-Dist: pandas-stubs>=2.2.3; extra == "quality"
41
+ Requires-Dist: scipy-stubs>=1.13.1; extra == "quality"
42
+ Provides-Extra: build
43
+ Requires-Dist: build==1.4.0; extra == "build"
44
+ Requires-Dist: twine==6.2.0; extra == "build"
45
+ Requires-Dist: check-sdist==1.4.0; extra == "build"
46
+ Requires-Dist: check-wheel-contents==0.6.3; extra == "build"
47
+ Provides-Extra: test
48
+ Requires-Dist: pytest>=8.4.2; extra == "test"
49
+ Requires-Dist: pytest-cov>=6.0.0; extra == "test"
50
+ Provides-Extra: dev
51
+ Requires-Dist: pre-commit>=4.0.0; extra == "dev"
52
+ Requires-Dist: ruff==0.14.9; extra == "dev"
53
+ Dynamic: license-file
54
+
55
+ # simple-sklearn
56
+
57
+ [![CI/CD](https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml/badge.svg)][ci-cd-url]
58
+ [![codecov](https://codecov.io/gh/Artem259/simple-sklearn/graph/badge.svg)][codecov-url]
59
+ [![PyPI version](https://badge.fury.io/py/simple-sklearn.svg)][pypi-url]
60
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)][python-url]
61
+ [![Docs](https://img.shields.io/badge/docs-GitHub_Pages-blue.svg)][docs-url]
62
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][license-url]
63
+
64
+ **simple-sklearn** is a Python package designed to provide clear, readable, and highly pythonic implementations of
65
+ fundamental machine learning algorithms. Abstracting away from complex low-level optimizations, this library
66
+ focuses on clarity and educational value using high-level libraries like `numpy`, `pandas`, and `scipy`.
67
+
68
+ Every model is designed to integrate seamlessly with scikit-learn's estimator API, inheriting from
69
+ `sklearn.base.BaseEstimator` and the appropriate mixins (`ClassifierMixin` or `ClusterMixin`). This allows you
70
+ to plug these simple implementations directly into `scikit-learn` pipelines and cross-validation workflows.
71
+
72
+ **WARNING: Not for Production Use.** This library is built for educational purposes and algorithmic transparency.
73
+ The implementations prioritize readability and simplicity over execution speed and memory optimization.
74
+
75
+ ---
76
+
77
+ ## Available Models
78
+
79
+ **Classification:**
80
+
81
+ * OneRClassifier: 1R (One Rule) classification.
82
+ * NaiveBayesClassifier: Categorical Naive Bayes classification.
83
+ * KNeighborsClassifier: K-Nearest Neighbors classification.
84
+ * DecisionTreeClassifier: Decision Tree classification using the ID3 algorithm.
85
+
86
+ **Clustering:**
87
+
88
+ * KMeans: K-Means clustering.
89
+ * KMedoids: K-Medoids clustering.
90
+ * DBSCAN: Density-Based Spatial Clustering of Applications with Noise.
91
+ * AgglomerativeClustering: Hierarchical agglomerative clustering.
92
+
93
+ ---
94
+
95
+ ## Installation
96
+
97
+ **Requirements:**
98
+
99
+ * Python 3.10+
100
+
101
+ **Install directly from PyPI** using `pip`:
102
+
103
+ ```bash
104
+ pip install simple-sklearn
105
+ ```
106
+
107
+ Core Dependencies:
108
+
109
+ * scikit-learn (>= 1.6.1)
110
+ * numpy (>= 1.26)
111
+ * pandas (>= 2.2.3)
112
+ * scipy (>= 1.13.1)
113
+ * typing-extensions (>=4.1.0, <5.0)
114
+
115
+ ---
116
+
117
+ ## Quick Start
118
+
119
+ Because simple-sklearn strictly implements the scikit-learn API, you can fit and predict models exactly as you would
120
+ with scikit-learn.
121
+
122
+ ### Classification Example
123
+
124
+ ```python
125
+ import numpy as np
126
+ from simple_sklearn.classification import NaiveBayesClassifier
127
+
128
+ # Categorical data
129
+ X = np.array([[0, 0], [0, 1], [1, 0], [2, 2], [2, 3]])
130
+ y = np.array([0, 0, 0, 1, 1])
131
+
132
+ # Initialize and fit the model
133
+ clf = NaiveBayesClassifier()
134
+ clf.fit(X, y)
135
+
136
+ # Predict on new data
137
+ X_new = np.array([[2, 2], [1, 4]])
138
+ predictions = clf.predict(X_new) # Handles unseen category '4' gracefully
139
+ print(f"Predictions: {predictions}") # Output: [1 0]
140
+ ```
141
+
142
+ ### Clustering Example
143
+
144
+ ```python
145
+ import numpy as np
146
+ from simple_sklearn.clustering import KMeans
147
+
148
+ # Continuous data
149
+ X = np.array([[0.1, 0.1], [0.2, 0.1], [10.1, 10.1], [10.2, 10.1]])
150
+
151
+ # Initialize and fit the model
152
+ clusterer = KMeans(n_clusters=2, max_iter=10, random_state=42)
153
+ clusterer.fit(X)
154
+
155
+ print(f"Cluster labels: {clusterer.labels_}") # Output: [0 0 1 1]
156
+ print(f"Cluster centers: \n{clusterer.cluster_centers_}") # Output: [[0.15, 0.1], [10.15, 10.1]]
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Documentation
162
+
163
+ Detailed API references, algorithm details, and Jupyter Notebook usage examples are available on the library website:
164
+
165
+ **[Artem259.github.io/simple-sklearn][docs-url]**
166
+
167
+ ---
168
+
169
+ ## Development & Contributing
170
+
171
+ Pull requests are welcome! If you'd like to contribute, please read the [Contributing Guide][contrib-url].
172
+
173
+ ---
174
+
175
+ ## Roadmap
176
+
177
+ Future development focuses on:
178
+
179
+ 1. Estimator Enhancements and Performance Optimization:
180
+ * Implementing a custom KDTree for faster nearest-neighbor searches.
181
+ * Refactoring AgglomerativeClustering with Priority Queue (Min-Heap) to reduce time complexity
182
+ during cluster merging.
183
+ * Adding other estimator features (e.g., standard hyperparameters like `max_depth` for `DecisionTreeClassifier`).
184
+ 2. Documentation Upgrades:
185
+ * Configuring documentation versioning via the `mike` tool.
186
+
187
+ ---
188
+
189
+ ## License
190
+
191
+ This project is licensed under the [MIT License][license-url].
192
+
193
+ [ci-cd-url]: https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml
194
+ [codecov-url]: https://codecov.io/gh/Artem259/simple-sklearn
195
+ [pypi-url]: https://pypi.org/p/simple-sklearn
196
+ [python-url]: https://www.python.org/downloads/
197
+ [docs-url]: https://Artem259.github.io/simple-sklearn
198
+ [license-url]: https://github.com/Artem259/simple-sklearn/blob/main/LICENSE
199
+ [contrib-url]: https://github.com/Artem259/simple-sklearn/blob/main/CONTRIBUTING.md
@@ -0,0 +1,145 @@
1
+ # simple-sklearn
2
+
3
+ [![CI/CD](https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml/badge.svg)][ci-cd-url]
4
+ [![codecov](https://codecov.io/gh/Artem259/simple-sklearn/graph/badge.svg)][codecov-url]
5
+ [![PyPI version](https://badge.fury.io/py/simple-sklearn.svg)][pypi-url]
6
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)][python-url]
7
+ [![Docs](https://img.shields.io/badge/docs-GitHub_Pages-blue.svg)][docs-url]
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][license-url]
9
+
10
+ **simple-sklearn** is a Python package designed to provide clear, readable, and highly pythonic implementations of
11
+ fundamental machine learning algorithms. Abstracting away from complex low-level optimizations, this library
12
+ focuses on clarity and educational value using high-level libraries like `numpy`, `pandas`, and `scipy`.
13
+
14
+ Every model is designed to integrate seamlessly with scikit-learn's estimator API, inheriting from
15
+ `sklearn.base.BaseEstimator` and the appropriate mixins (`ClassifierMixin` or `ClusterMixin`). This allows you
16
+ to plug these simple implementations directly into `scikit-learn` pipelines and cross-validation workflows.
17
+
18
+ **WARNING: Not for Production Use.** This library is built for educational purposes and algorithmic transparency.
19
+ The implementations prioritize readability and simplicity over execution speed and memory optimization.
20
+
21
+ ---
22
+
23
+ ## Available Models
24
+
25
+ **Classification:**
26
+
27
+ * OneRClassifier: 1R (One Rule) classification.
28
+ * NaiveBayesClassifier: Categorical Naive Bayes classification.
29
+ * KNeighborsClassifier: K-Nearest Neighbors classification.
30
+ * DecisionTreeClassifier: Decision Tree classification using the ID3 algorithm.
31
+
32
+ **Clustering:**
33
+
34
+ * KMeans: K-Means clustering.
35
+ * KMedoids: K-Medoids clustering.
36
+ * DBSCAN: Density-Based Spatial Clustering of Applications with Noise.
37
+ * AgglomerativeClustering: Hierarchical agglomerative clustering.
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ **Requirements:**
44
+
45
+ * Python 3.10+
46
+
47
+ **Install directly from PyPI** using `pip`:
48
+
49
+ ```bash
50
+ pip install simple-sklearn
51
+ ```
52
+
53
+ Core Dependencies:
54
+
55
+ * scikit-learn (>= 1.6.1)
56
+ * numpy (>= 1.26)
57
+ * pandas (>= 2.2.3)
58
+ * scipy (>= 1.13.1)
59
+ * typing-extensions (>=4.1.0, <5.0)
60
+
61
+ ---
62
+
63
+ ## Quick Start
64
+
65
+ Because simple-sklearn strictly implements the scikit-learn API, you can fit and predict models exactly as you would
66
+ with scikit-learn.
67
+
68
+ ### Classification Example
69
+
70
+ ```python
71
+ import numpy as np
72
+ from simple_sklearn.classification import NaiveBayesClassifier
73
+
74
+ # Categorical data
75
+ X = np.array([[0, 0], [0, 1], [1, 0], [2, 2], [2, 3]])
76
+ y = np.array([0, 0, 0, 1, 1])
77
+
78
+ # Initialize and fit the model
79
+ clf = NaiveBayesClassifier()
80
+ clf.fit(X, y)
81
+
82
+ # Predict on new data
83
+ X_new = np.array([[2, 2], [1, 4]])
84
+ predictions = clf.predict(X_new) # Handles unseen category '4' gracefully
85
+ print(f"Predictions: {predictions}") # Output: [1 0]
86
+ ```
87
+
88
+ ### Clustering Example
89
+
90
+ ```python
91
+ import numpy as np
92
+ from simple_sklearn.clustering import KMeans
93
+
94
+ # Continuous data
95
+ X = np.array([[0.1, 0.1], [0.2, 0.1], [10.1, 10.1], [10.2, 10.1]])
96
+
97
+ # Initialize and fit the model
98
+ clusterer = KMeans(n_clusters=2, max_iter=10, random_state=42)
99
+ clusterer.fit(X)
100
+
101
+ print(f"Cluster labels: {clusterer.labels_}") # Output: [0 0 1 1]
102
+ print(f"Cluster centers: \n{clusterer.cluster_centers_}") # Output: [[0.15, 0.1], [10.15, 10.1]]
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Documentation
108
+
109
+ Detailed API references, algorithm details, and Jupyter Notebook usage examples are available on the library website:
110
+
111
+ **[Artem259.github.io/simple-sklearn][docs-url]**
112
+
113
+ ---
114
+
115
+ ## Development & Contributing
116
+
117
+ Pull requests are welcome! If you'd like to contribute, please read the [Contributing Guide][contrib-url].
118
+
119
+ ---
120
+
121
+ ## Roadmap
122
+
123
+ Future development focuses on:
124
+
125
+ 1. Estimator Enhancements and Performance Optimization:
126
+ * Implementing a custom KDTree for faster nearest-neighbor searches.
127
+ * Refactoring AgglomerativeClustering with Priority Queue (Min-Heap) to reduce time complexity
128
+ during cluster merging.
129
+ * Adding other estimator features (e.g., standard hyperparameters like `max_depth` for `DecisionTreeClassifier`).
130
+ 2. Documentation Upgrades:
131
+ * Configuring documentation versioning via the `mike` tool.
132
+
133
+ ---
134
+
135
+ ## License
136
+
137
+ This project is licensed under the [MIT License][license-url].
138
+
139
+ [ci-cd-url]: https://github.com/Artem259/simple-sklearn/actions/workflows/ci-cd.yml
140
+ [codecov-url]: https://codecov.io/gh/Artem259/simple-sklearn
141
+ [pypi-url]: https://pypi.org/p/simple-sklearn
142
+ [python-url]: https://www.python.org/downloads/
143
+ [docs-url]: https://Artem259.github.io/simple-sklearn
144
+ [license-url]: https://github.com/Artem259/simple-sklearn/blob/main/LICENSE
145
+ [contrib-url]: https://github.com/Artem259/simple-sklearn/blob/main/CONTRIBUTING.md
@@ -0,0 +1,24 @@
1
+ # Data
2
+
3
+ This directory contains the datasets used in tests and the documentation's usage example notebooks.
4
+
5
+ ---
6
+
7
+ ## Datasets
8
+
9
+ ### Student Performance
10
+
11
+ * **File:** `_student_performance.csv`
12
+ * **Source:** [Students Performance Dataset on Kaggle][1.1]
13
+ * **License:** [Attribution 4.0 International (CC BY 4.0)][1.2]
14
+
15
+ ### Country Data
16
+
17
+ * **File:** `_country_data.csv`
18
+ * **Source:** [Unsupervised Learning on Country Data on Kaggle][2.1]
19
+ * **License:** [MIT License][2.2]
20
+
21
+ [1.1]: https://www.kaggle.com/datasets/rabieelkharoua/students-performance-dataset
22
+ [1.2]: https://creativecommons.org/licenses/by/4.0/
23
+ [2.1]: https://www.kaggle.com/datasets/rohan0301/unsupervised-learning-on-country-data
24
+ [2.2]: https://opensource.org/licenses/MIT
@@ -0,0 +1,11 @@
1
+ x0,x1,x2,x3,y
2
+ 0,0,1,0,0
3
+ 1,0,0,1,1
4
+ 2,0,1,0,1
5
+ 0,1,0,0,1
6
+ 0,1,1,0,1
7
+ 0,1,1,1,0
8
+ 1,0,0,1,0
9
+ 2,0,0,0,1
10
+ 2,1,1,0,1
11
+ 0,1,1,1,0
@@ -0,0 +1,11 @@
1
+ x,y,label
2
+ 1,5,A
3
+ 2,4,B
4
+ 2,7,C
5
+ 2,9,D
6
+ 3,1,E
7
+ 5,5,F
8
+ 5,7,G
9
+ 6,6,H
10
+ 7,6,I
11
+ 10,6,J