mlx-learn 0.1.2__tar.gz → 0.1.3__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 (96) hide show
  1. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/PKG-INFO +49 -4
  2. mlx_learn-0.1.2/src/mlx_learn.egg-info/PKG-INFO → mlx_learn-0.1.3/README.md +45 -48
  3. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/THIRD_PARTY_NOTICES.md +72 -4
  4. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/pyproject.toml +2 -1
  5. mlx_learn-0.1.2/README.md → mlx_learn-0.1.3/src/mlx_learn.egg-info/PKG-INFO +93 -3
  6. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlx_learn.egg-info/SOURCES.txt +6 -0
  7. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlx_learn.egg-info/requires.txt +4 -0
  8. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/__init__.py +1 -1
  9. mlx_learn-0.1.3/src/mlxlearn/_kernels/e_means.py +363 -0
  10. mlx_learn-0.1.3/src/mlxlearn/_kernels/e_means_bf16.py +389 -0
  11. mlx_learn-0.1.3/src/mlxlearn/cluster/__init__.py +6 -0
  12. mlx_learn-0.1.3/src/mlxlearn/cluster/_e_means.py +601 -0
  13. mlx_learn-0.1.3/src/mlxlearn/cluster/_k_means.py +424 -0
  14. mlx_learn-0.1.3/src/mlxlearn/cluster/_recipe.py +150 -0
  15. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/LICENSE +0 -0
  16. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/MANIFEST.in +0 -0
  17. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/setup.cfg +0 -0
  18. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/setup.py +0 -0
  19. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlx_learn.egg-info/dependency_links.txt +0 -0
  20. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlx_learn.egg-info/not-zip-safe +0 -0
  21. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlx_learn.egg-info/top_level.txt +0 -0
  22. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/__init__.py +0 -0
  23. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/arrays.py +0 -0
  24. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/base.py +0 -0
  25. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/config.py +0 -0
  26. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/device.py +0 -0
  27. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/diagnostics.py +0 -0
  28. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/preparation.py +0 -0
  29. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/rng.py +0 -0
  30. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_common/validation.py +0 -0
  31. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/__init__.py +0 -0
  32. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/_neighbors_cpu_native.cpp +0 -0
  33. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/_svc_cpu_native.cpp +0 -0
  34. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/distance.py +0 -0
  35. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/kernels.py +0 -0
  36. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/logistic_input.py +0 -0
  37. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/neighbors_cpu.py +0 -0
  38. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/pca_input.py +0 -0
  39. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/svc_cpu.py +0 -0
  40. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/svc_fused.py +0 -0
  41. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_kernels/svc_predict.py +0 -0
  42. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/__init__.py +0 -0
  43. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/_metal_cg.h +0 -0
  44. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/_metal_loop.mm +0 -0
  45. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/_smo_block_native.cpp +0 -0
  46. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/_smo_native.cpp +0 -0
  47. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/block_smo.py +0 -0
  48. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/fused_lbfgs.py +0 -0
  49. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/lbfgs.py +0 -0
  50. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/logistic.py +0 -0
  51. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/native_command.py +0 -0
  52. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/native_geometry.py +0 -0
  53. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/native_logistic.py +0 -0
  54. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/native_logistic_fused.py +0 -0
  55. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/native_smo.py +0 -0
  56. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/pca.py +0 -0
  57. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/_solvers/smo.py +0 -0
  58. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/decomposition/__init__.py +0 -0
  59. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/decomposition/_pca.py +0 -0
  60. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/exceptions.py +0 -0
  61. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/linear_model/__init__.py +0 -0
  62. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/linear_model/_logistic.py +0 -0
  63. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/neighbors/__init__.py +0 -0
  64. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/neighbors/_base.py +0 -0
  65. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/neighbors/_classification.py +0 -0
  66. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/neighbors/_regression.py +0 -0
  67. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/neighbors/_unsupervised.py +0 -0
  68. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/patching/__init__.py +0 -0
  69. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/patching/_estimators.py +0 -0
  70. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/patching/_patch.py +0 -0
  71. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/patching/_registry.py +0 -0
  72. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/py.typed +0 -0
  73. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/svm/__init__.py +0 -0
  74. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn/svm/_classes.py +0 -0
  75. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/__init__.py +0 -0
  76. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_compensated.py +0 -0
  77. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_duality.py +0 -0
  78. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_hessian_vector.py +0 -0
  79. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_logistic.py +0 -0
  80. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_native.py +0 -0
  81. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_native_cg.py +0 -0
  82. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors.py +0 -0
  83. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_compact.py +0 -0
  84. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_fused.py +0 -0
  85. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_general.py +0 -0
  86. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_integer.py +0 -0
  87. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_paired.py +0 -0
  88. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_precision.py +0 -0
  89. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_registers.py +0 -0
  90. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_screen.py +0 -0
  91. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_shortlist.py +0 -0
  92. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_small.py +0 -0
  93. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_neighbors_votes.py +0 -0
  94. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/_newton.py +0 -0
  95. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/src/mlxlearn_device/hessian_sketch.py +0 -0
  96. {mlx_learn-0.1.2 → mlx_learn-0.1.3}/tests/test_sklearn_compliance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mlx-learn
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: MLX-accelerated classical machine learning with a scikit-learn compatible API for Apple silicon
5
5
  Author: Bojan Tunguz
6
6
  License-Expression: Apache-2.0
@@ -35,6 +35,9 @@ Requires-Dist: packaging>=23.0; extra == "test"
35
35
  Provides-Extra: bench
36
36
  Requires-Dist: pytest>=8.0; extra == "bench"
37
37
  Requires-Dist: scipy>=1.10; extra == "bench"
38
+ Provides-Extra: e-means-bench
39
+ Requires-Dist: faiss-cpu>=1.12; extra == "e-means-bench"
40
+ Requires-Dist: h5py>=3.10; extra == "e-means-bench"
38
41
  Provides-Extra: dev
39
42
  Requires-Dist: pytest>=8.0; extra == "dev"
40
43
  Requires-Dist: scipy>=1.10; extra == "dev"
@@ -83,7 +86,7 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
83
86
 
84
87
  ## Status
85
88
 
86
- **`0.1.2` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
89
+ **`0.1.3` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
87
90
 
88
91
  | Estimator | Status |
89
92
  |---|---|
@@ -93,10 +96,52 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
93
96
  | `mlxlearn.linear_model.LogisticRegression` | 0.1.0 |
94
97
  | `mlxlearn.svm.SVC` (exact) | 0.1.0 |
95
98
  | `mlxlearn.decomposition.PCA` | 0.1.2 |
96
- | `LinearRegression`, `Ridge`, `KMeans`, `DBSCAN`, `TSNE` | planned, 0.2.x |
99
+ | `mlxlearn.cluster.EMeans` | 0.1.3; Metal GPU, paper/Faiss recipes |
100
+ | `mlxlearn.cluster.KMeans` | 0.1.3; Metal GPU, Lloyd clustering |
101
+ | `LinearRegression`, `Ridge`, `DBSCAN`, `TSNE` | planned, 0.2.x |
97
102
  | `SVR`, `NuSVR`, `NuSVC` | deferred — will not ship until they implement the true objective |
98
103
  | tree ensembles | out of scope |
99
104
 
105
+ ## E-means clustering
106
+
107
+ Version 0.1.3 includes [e-means](https://arxiv.org/abs/2611.09501),
108
+ with Metal assignment and update kernels for Apple Silicon:
109
+
110
+ ```python
111
+ from mlxlearn.cluster import EMeans
112
+
113
+ model = EMeans(n_clusters=4096, max_iter=3, random_state=10).fit(X_train)
114
+ labels = model.predict(X_test)
115
+ ```
116
+
117
+ It supports the published recipe, a separately specified Faiss recipe,
118
+ last-epoch means, slow EMA, and spherical clustering. See the
119
+ [implementation guide](docs/e-means.md) and [reproducible paper-data benchmarks](benchmarks/e_means/README.md).
120
+ Measured results are in the [M4 Max benchmark report](docs/e-means-benchmarks-2026-11-14.md).
121
+ The [direct Faiss e-means comparison](docs/e-means-faiss-comparison-2026-11-14.md)
122
+ measures runtime, process memory, and held-out quality with matched Faiss recipes.
123
+ `precision="bfloat16"` enables native BF16 Metal assignment with float32
124
+ accumulation and state, plus the Faiss BF16 statistics semantics. The
125
+ [optimization and H100 protocol report](docs/e-means-h100-protocol-2026-11-14.md)
126
+ compares it with a matched Metal GEMM baseline and documents the limits of
127
+ comparison with published H100 times.
128
+ The subsequent [hardware-gap investigation](docs/e-means-gap-investigation-2026-11-14.md)
129
+ separates arithmetic throughput from implementation overhead and compares further
130
+ optimizations against a frozen native-BF16 implementation in fresh paired runs.
131
+ The [five-dataset 10M-vector comparison](docs/e-means-10m-comparison-2026-11-14.md)
132
+ measures matched FP32 Metal and original Faiss CPU runs: Metal is 3.98–18.95×
133
+ faster, with test-MSE differences within 0.061% in this single-seed campaign.
134
+ `EMeans` is an explicit estimator; it does not replace sklearn's `KMeans` through patching.
135
+
136
+ For full-batch Lloyd clustering, [Metal `KMeans`](docs/k-means.md) is available
137
+ through `from mlxlearn.cluster import KMeans`. It supports dense FP32 training,
138
+ explicit, random or k-means++ initialization, multiple restarts, and final
139
+ nearest-centroid labels and inertia. Use the direct estimator; it is not part
140
+ of `patch_sklearn()`.
141
+
142
+ The [four-method 10M-vector comparison](docs/k-means-10m-comparison-2026-11-15.md)
143
+ reports runtime, peak fit memory, and test MSE on five datasets.
144
+
100
145
  ## Requirements
101
146
 
102
147
  - macOS on Apple silicon (arm64)
@@ -112,7 +157,7 @@ CI tests only valid pairs — see [`docs/support_matrix.md`](docs/support_matrix
112
157
  pip install mlx-learn
113
158
  ```
114
159
 
115
- Version `0.1.2` provides Apple silicon wheels for Python 3.10–3.13 with Metal
160
+ Version `0.1.3` provides Apple silicon wheels for Python 3.10–3.13 with Metal
116
161
  and C++ CPU extensions. Source builds can also include these optional extensions.
117
162
  The KNN CPU extension handles small workloads and is compiled at build time;
118
163
  fitting or querying never invokes the C++ compiler. A compatible wheel includes
@@ -1,48 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: mlx-learn
3
- Version: 0.1.2
4
- Summary: MLX-accelerated classical machine learning with a scikit-learn compatible API for Apple silicon
5
- Author: Bojan Tunguz
6
- License-Expression: Apache-2.0
7
- Project-URL: Homepage, https://github.com/tabulai/mlx-learn
8
- Project-URL: Repository, https://github.com/tabulai/mlx-learn
9
- Project-URL: Changelog, https://github.com/tabulai/mlx-learn/blob/main/CHANGELOG.md
10
- Project-URL: Issues, https://github.com/tabulai/mlx-learn/issues
11
- Keywords: machine-learning,mlx,apple-silicon,scikit-learn,gpu
12
- Classifier: Development Status :: 3 - Alpha
13
- Classifier: Intended Audience :: Science/Research
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Operating System :: MacOS :: MacOS X
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Programming Language :: Python :: 3.12
20
- Classifier: Programming Language :: Python :: 3.13
21
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
- Classifier: Typing :: Typed
23
- Requires-Python: >=3.10
24
- Description-Content-Type: text/markdown
25
- License-File: LICENSE
26
- License-File: THIRD_PARTY_NOTICES.md
27
- Requires-Dist: numpy>=1.23.5
28
- Requires-Dist: scipy>=1.10
29
- Requires-Dist: scikit-learn<1.10,>=1.7
30
- Requires-Dist: mlx<1.0,>=0.29
31
- Provides-Extra: test
32
- Requires-Dist: pytest>=8.0; extra == "test"
33
- Requires-Dist: scipy>=1.10; extra == "test"
34
- Requires-Dist: packaging>=23.0; extra == "test"
35
- Provides-Extra: bench
36
- Requires-Dist: pytest>=8.0; extra == "bench"
37
- Requires-Dist: scipy>=1.10; extra == "bench"
38
- Provides-Extra: dev
39
- Requires-Dist: pytest>=8.0; extra == "dev"
40
- Requires-Dist: scipy>=1.10; extra == "dev"
41
- Requires-Dist: ruff>=0.6; extra == "dev"
42
- Requires-Dist: build>=1.2; extra == "dev"
43
- Requires-Dist: twine>=5.0; extra == "dev"
44
- Dynamic: license-file
45
-
46
1
  # mlxlearn
47
2
 
48
3
  **Classical machine learning on Apple silicon, accelerated with [MLX](https://github.com/ml-explore/mlx), with a scikit-learn compatible API.**
@@ -83,7 +38,7 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
83
38
 
84
39
  ## Status
85
40
 
86
- **`0.1.2` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
41
+ **`0.1.3` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
87
42
 
88
43
  | Estimator | Status |
89
44
  |---|---|
@@ -93,10 +48,52 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
93
48
  | `mlxlearn.linear_model.LogisticRegression` | 0.1.0 |
94
49
  | `mlxlearn.svm.SVC` (exact) | 0.1.0 |
95
50
  | `mlxlearn.decomposition.PCA` | 0.1.2 |
96
- | `LinearRegression`, `Ridge`, `KMeans`, `DBSCAN`, `TSNE` | planned, 0.2.x |
51
+ | `mlxlearn.cluster.EMeans` | 0.1.3; Metal GPU, paper/Faiss recipes |
52
+ | `mlxlearn.cluster.KMeans` | 0.1.3; Metal GPU, Lloyd clustering |
53
+ | `LinearRegression`, `Ridge`, `DBSCAN`, `TSNE` | planned, 0.2.x |
97
54
  | `SVR`, `NuSVR`, `NuSVC` | deferred — will not ship until they implement the true objective |
98
55
  | tree ensembles | out of scope |
99
56
 
57
+ ## E-means clustering
58
+
59
+ Version 0.1.3 includes [e-means](https://arxiv.org/abs/2611.09501),
60
+ with Metal assignment and update kernels for Apple Silicon:
61
+
62
+ ```python
63
+ from mlxlearn.cluster import EMeans
64
+
65
+ model = EMeans(n_clusters=4096, max_iter=3, random_state=10).fit(X_train)
66
+ labels = model.predict(X_test)
67
+ ```
68
+
69
+ It supports the published recipe, a separately specified Faiss recipe,
70
+ last-epoch means, slow EMA, and spherical clustering. See the
71
+ [implementation guide](docs/e-means.md) and [reproducible paper-data benchmarks](benchmarks/e_means/README.md).
72
+ Measured results are in the [M4 Max benchmark report](docs/e-means-benchmarks-2026-11-14.md).
73
+ The [direct Faiss e-means comparison](docs/e-means-faiss-comparison-2026-11-14.md)
74
+ measures runtime, process memory, and held-out quality with matched Faiss recipes.
75
+ `precision="bfloat16"` enables native BF16 Metal assignment with float32
76
+ accumulation and state, plus the Faiss BF16 statistics semantics. The
77
+ [optimization and H100 protocol report](docs/e-means-h100-protocol-2026-11-14.md)
78
+ compares it with a matched Metal GEMM baseline and documents the limits of
79
+ comparison with published H100 times.
80
+ The subsequent [hardware-gap investigation](docs/e-means-gap-investigation-2026-11-14.md)
81
+ separates arithmetic throughput from implementation overhead and compares further
82
+ optimizations against a frozen native-BF16 implementation in fresh paired runs.
83
+ The [five-dataset 10M-vector comparison](docs/e-means-10m-comparison-2026-11-14.md)
84
+ measures matched FP32 Metal and original Faiss CPU runs: Metal is 3.98–18.95×
85
+ faster, with test-MSE differences within 0.061% in this single-seed campaign.
86
+ `EMeans` is an explicit estimator; it does not replace sklearn's `KMeans` through patching.
87
+
88
+ For full-batch Lloyd clustering, [Metal `KMeans`](docs/k-means.md) is available
89
+ through `from mlxlearn.cluster import KMeans`. It supports dense FP32 training,
90
+ explicit, random or k-means++ initialization, multiple restarts, and final
91
+ nearest-centroid labels and inertia. Use the direct estimator; it is not part
92
+ of `patch_sklearn()`.
93
+
94
+ The [four-method 10M-vector comparison](docs/k-means-10m-comparison-2026-11-15.md)
95
+ reports runtime, peak fit memory, and test MSE on five datasets.
96
+
100
97
  ## Requirements
101
98
 
102
99
  - macOS on Apple silicon (arm64)
@@ -112,7 +109,7 @@ CI tests only valid pairs — see [`docs/support_matrix.md`](docs/support_matrix
112
109
  pip install mlx-learn
113
110
  ```
114
111
 
115
- Version `0.1.2` provides Apple silicon wheels for Python 3.10–3.13 with Metal
112
+ Version `0.1.3` provides Apple silicon wheels for Python 3.10–3.13 with Metal
116
113
  and C++ CPU extensions. Source builds can also include these optional extensions.
117
114
  The KNN CPU extension handles small workloads and is compiled at build time;
118
115
  fitting or querying never invokes the C++ compiler. A compatible wheel includes
@@ -12,11 +12,70 @@ a source file carries an upstream copyright header that is not accounted for her
12
12
 
13
13
  ## 1. Copied or derived source
14
14
 
15
- **None as of 0.1.0a2.**
15
+ ### MLX Steel fragment layout and vector loads
16
+
17
+ `src/mlxlearn/_kernels/e_means_bf16.py` derives SIMD matrix fragment coordinate
18
+ mapping and contiguous vector-load techniques from MLX 0.32.4,
19
+ `mlx/backend/metal/kernels/steel/gemm/mma.h` and `loader.h`. The retained upstream
20
+ header is `Copyright © 2024 Apple Inc.`. The implementation was modified on
21
+ 2026-11-14 for native BF16 fragments, fused centroid selection, ragged loads,
22
+ bounded row batching, and Python dispatch. The experimental predecessor is
23
+ `benchmarks/e_means/experimental_kernels.py`.
24
+
25
+ The following immutable benchmark records embed snapshots of that experimental
26
+ source, including its retained `Copyright © 2024 Apple Inc.` notice and source
27
+ SHA-256. Those embedded source copies are covered by this same attribution and
28
+ MIT license:
29
+
30
+ - `benchmarks/e_means/results/optimization/bf16-dispatch-sweep.json`
31
+ - `benchmarks/e_means/results/optimization/bf16-tile-sweep3.json`
32
+ - `benchmarks/e_means/results/optimization/bf16-tile-sweep4.json`
33
+
34
+ The next investigation retains the same attributed source in its verified
35
+ baseline archive/extraction and generated-kernel experiment records:
36
+
37
+ - `benchmarks/e_means/reference/metal-v2-source.zip`
38
+ - `benchmarks/e_means/results/gap_investigation/source/metal_v2_e_means_bf16.py`
39
+ - `benchmarks/e_means/results/gap_investigation/roofline.json`
40
+ - `benchmarks/e_means/results/gap_investigation/schedule.json`
41
+ - `benchmarks/e_means/results/gap_investigation/tiles.json`
42
+ - `benchmarks/e_means/results/gap_investigation/lowdim.json`
43
+ - `benchmarks/e_means/results/gap_investigation/coalescing.json`
44
+
45
+ `benchmarks/e_means/experiments/gap_assignment.py` and
46
+ `benchmarks/e_means/experiments/gap_coalescing.py` generate modified variants
47
+ of the attributed Metal source. Their modification notices identify the
48
+ 2026-11-14 scheduling, tiling, and partial-result layout experiments. Raw JSON
49
+ records remain immutable, including the source snapshots and hashes captured
50
+ when each experiment ran; the frozen baseline loader verifies the extracted
51
+ source against the archive before reuse.
52
+
53
+ These source files are covered by the MIT license reproduced below. Historical
54
+ attestations for version 0.1.0a2 predate this addition.
16
55
 
17
- No source file in `src/mlxlearn/` was copied from another project. Every module was newly
18
- written for this repository; see [`ACKNOWLEDGMENTS.md`](ACKNOWLEDGMENTS.md) and
19
- [`phase0/attestation.md`](phase0/attestation.md).
56
+ ```
57
+ MIT License
58
+
59
+ Copyright © 2024 Apple Inc.
60
+
61
+ Permission is hereby granted, free of charge, to any person obtaining a copy
62
+ of this software and associated documentation files (the "Software"), to deal
63
+ in the Software without restriction, including without limitation the rights
64
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65
+ copies of the Software, and to permit persons to whom the Software is
66
+ furnished to do so, subject to the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be included in
69
+ all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
74
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
76
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
77
+ IN THE SOFTWARE.
78
+ ```
20
79
 
21
80
  If a future change introduces derived code, it must be added to this section with:
22
81
 
@@ -164,6 +223,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
164
223
 
165
224
  ## 5. Algorithmic references
166
225
 
226
+ The e-means implementation follows Bessa et al., *e-means: outperforming
227
+ k-means (in one-tenth the epochs)*, arXiv:2611.09501v1 (2026), and the MIT-licensed
228
+ Faiss reference at revision `ebab8f784c1d177129602269d5ad966c525fbdcb`,
229
+ copyright Meta Platforms, Inc. and affiliates. The estimator and Metal kernels
230
+ were written for mlxlearn. Benchmarks load the upstream code from a separate
231
+ checkout which retains its license, use upstream dataset split fingerprints,
232
+ and credit the original datasets. Faiss is an optional benchmark dependency.
233
+ See [the benchmark guide](benchmarks/e_means/README.md).
234
+
167
235
  The October 31, 2026 SVC optimization study inspected scikit-learn-intelex
168
236
  commit `f50ab692e6296b573efaaa3d05304a8eb3fbcf8d` and oneDAL tag `2026.2.0`.
169
237
  Their native working-set decomposition and persistent-model patterns informed
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mlx-learn"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  description = "MLX-accelerated classical machine learning with a scikit-learn compatible API for Apple silicon"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -35,6 +35,7 @@ dependencies = [
35
35
  [project.optional-dependencies]
36
36
  test = ["pytest>=8.0", "scipy>=1.10", "packaging>=23.0"]
37
37
  bench = ["pytest>=8.0", "scipy>=1.10"]
38
+ e-means-bench = ["faiss-cpu>=1.12", "h5py>=3.10"]
38
39
  dev = ["pytest>=8.0", "scipy>=1.10", "ruff>=0.6", "build>=1.2", "twine>=5.0"]
39
40
 
40
41
  [project.urls]
@@ -1,3 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: mlx-learn
3
+ Version: 0.1.3
4
+ Summary: MLX-accelerated classical machine learning with a scikit-learn compatible API for Apple silicon
5
+ Author: Bojan Tunguz
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/tabulai/mlx-learn
8
+ Project-URL: Repository, https://github.com/tabulai/mlx-learn
9
+ Project-URL: Changelog, https://github.com/tabulai/mlx-learn/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/tabulai/mlx-learn/issues
11
+ Keywords: machine-learning,mlx,apple-silicon,scikit-learn,gpu
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ License-File: THIRD_PARTY_NOTICES.md
27
+ Requires-Dist: numpy>=1.23.5
28
+ Requires-Dist: scipy>=1.10
29
+ Requires-Dist: scikit-learn<1.10,>=1.7
30
+ Requires-Dist: mlx<1.0,>=0.29
31
+ Provides-Extra: test
32
+ Requires-Dist: pytest>=8.0; extra == "test"
33
+ Requires-Dist: scipy>=1.10; extra == "test"
34
+ Requires-Dist: packaging>=23.0; extra == "test"
35
+ Provides-Extra: bench
36
+ Requires-Dist: pytest>=8.0; extra == "bench"
37
+ Requires-Dist: scipy>=1.10; extra == "bench"
38
+ Provides-Extra: e-means-bench
39
+ Requires-Dist: faiss-cpu>=1.12; extra == "e-means-bench"
40
+ Requires-Dist: h5py>=3.10; extra == "e-means-bench"
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest>=8.0; extra == "dev"
43
+ Requires-Dist: scipy>=1.10; extra == "dev"
44
+ Requires-Dist: ruff>=0.6; extra == "dev"
45
+ Requires-Dist: build>=1.2; extra == "dev"
46
+ Requires-Dist: twine>=5.0; extra == "dev"
47
+ Dynamic: license-file
48
+
1
49
  # mlxlearn
2
50
 
3
51
  **Classical machine learning on Apple silicon, accelerated with [MLX](https://github.com/ml-explore/mlx), with a scikit-learn compatible API.**
@@ -38,7 +86,7 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
38
86
 
39
87
  ## Status
40
88
 
41
- **`0.1.2` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
89
+ **`0.1.3` — alpha.** The API may change. See [CHANGELOG.md](CHANGELOG.md).
42
90
 
43
91
  | Estimator | Status |
44
92
  |---|---|
@@ -48,10 +96,52 @@ stock inheritance. See the [compatibility details](docs/support_matrix.md).
48
96
  | `mlxlearn.linear_model.LogisticRegression` | 0.1.0 |
49
97
  | `mlxlearn.svm.SVC` (exact) | 0.1.0 |
50
98
  | `mlxlearn.decomposition.PCA` | 0.1.2 |
51
- | `LinearRegression`, `Ridge`, `KMeans`, `DBSCAN`, `TSNE` | planned, 0.2.x |
99
+ | `mlxlearn.cluster.EMeans` | 0.1.3; Metal GPU, paper/Faiss recipes |
100
+ | `mlxlearn.cluster.KMeans` | 0.1.3; Metal GPU, Lloyd clustering |
101
+ | `LinearRegression`, `Ridge`, `DBSCAN`, `TSNE` | planned, 0.2.x |
52
102
  | `SVR`, `NuSVR`, `NuSVC` | deferred — will not ship until they implement the true objective |
53
103
  | tree ensembles | out of scope |
54
104
 
105
+ ## E-means clustering
106
+
107
+ Version 0.1.3 includes [e-means](https://arxiv.org/abs/2611.09501),
108
+ with Metal assignment and update kernels for Apple Silicon:
109
+
110
+ ```python
111
+ from mlxlearn.cluster import EMeans
112
+
113
+ model = EMeans(n_clusters=4096, max_iter=3, random_state=10).fit(X_train)
114
+ labels = model.predict(X_test)
115
+ ```
116
+
117
+ It supports the published recipe, a separately specified Faiss recipe,
118
+ last-epoch means, slow EMA, and spherical clustering. See the
119
+ [implementation guide](docs/e-means.md) and [reproducible paper-data benchmarks](benchmarks/e_means/README.md).
120
+ Measured results are in the [M4 Max benchmark report](docs/e-means-benchmarks-2026-11-14.md).
121
+ The [direct Faiss e-means comparison](docs/e-means-faiss-comparison-2026-11-14.md)
122
+ measures runtime, process memory, and held-out quality with matched Faiss recipes.
123
+ `precision="bfloat16"` enables native BF16 Metal assignment with float32
124
+ accumulation and state, plus the Faiss BF16 statistics semantics. The
125
+ [optimization and H100 protocol report](docs/e-means-h100-protocol-2026-11-14.md)
126
+ compares it with a matched Metal GEMM baseline and documents the limits of
127
+ comparison with published H100 times.
128
+ The subsequent [hardware-gap investigation](docs/e-means-gap-investigation-2026-11-14.md)
129
+ separates arithmetic throughput from implementation overhead and compares further
130
+ optimizations against a frozen native-BF16 implementation in fresh paired runs.
131
+ The [five-dataset 10M-vector comparison](docs/e-means-10m-comparison-2026-11-14.md)
132
+ measures matched FP32 Metal and original Faiss CPU runs: Metal is 3.98–18.95×
133
+ faster, with test-MSE differences within 0.061% in this single-seed campaign.
134
+ `EMeans` is an explicit estimator; it does not replace sklearn's `KMeans` through patching.
135
+
136
+ For full-batch Lloyd clustering, [Metal `KMeans`](docs/k-means.md) is available
137
+ through `from mlxlearn.cluster import KMeans`. It supports dense FP32 training,
138
+ explicit, random or k-means++ initialization, multiple restarts, and final
139
+ nearest-centroid labels and inertia. Use the direct estimator; it is not part
140
+ of `patch_sklearn()`.
141
+
142
+ The [four-method 10M-vector comparison](docs/k-means-10m-comparison-2026-11-15.md)
143
+ reports runtime, peak fit memory, and test MSE on five datasets.
144
+
55
145
  ## Requirements
56
146
 
57
147
  - macOS on Apple silicon (arm64)
@@ -67,7 +157,7 @@ CI tests only valid pairs — see [`docs/support_matrix.md`](docs/support_matrix
67
157
  pip install mlx-learn
68
158
  ```
69
159
 
70
- Version `0.1.2` provides Apple silicon wheels for Python 3.10–3.13 with Metal
160
+ Version `0.1.3` provides Apple silicon wheels for Python 3.10–3.13 with Metal
71
161
  and C++ CPU extensions. Source builds can also include these optional extensions.
72
162
  The KNN CPU extension handles small workloads and is compiled at build time;
73
163
  fitting or querying never invokes the C++ compiler. A compatible wheel includes
@@ -26,6 +26,8 @@ src/mlxlearn/_kernels/__init__.py
26
26
  src/mlxlearn/_kernels/_neighbors_cpu_native.cpp
27
27
  src/mlxlearn/_kernels/_svc_cpu_native.cpp
28
28
  src/mlxlearn/_kernels/distance.py
29
+ src/mlxlearn/_kernels/e_means.py
30
+ src/mlxlearn/_kernels/e_means_bf16.py
29
31
  src/mlxlearn/_kernels/kernels.py
30
32
  src/mlxlearn/_kernels/logistic_input.py
31
33
  src/mlxlearn/_kernels/neighbors_cpu.py
@@ -49,6 +51,10 @@ src/mlxlearn/_solvers/native_logistic_fused.py
49
51
  src/mlxlearn/_solvers/native_smo.py
50
52
  src/mlxlearn/_solvers/pca.py
51
53
  src/mlxlearn/_solvers/smo.py
54
+ src/mlxlearn/cluster/__init__.py
55
+ src/mlxlearn/cluster/_e_means.py
56
+ src/mlxlearn/cluster/_k_means.py
57
+ src/mlxlearn/cluster/_recipe.py
52
58
  src/mlxlearn/decomposition/__init__.py
53
59
  src/mlxlearn/decomposition/_pca.py
54
60
  src/mlxlearn/linear_model/__init__.py
@@ -14,6 +14,10 @@ ruff>=0.6
14
14
  build>=1.2
15
15
  twine>=5.0
16
16
 
17
+ [e-means-bench]
18
+ faiss-cpu>=1.12
19
+ h5py>=3.10
20
+
17
21
  [test]
18
22
  pytest>=8.0
19
23
  scipy>=1.10
@@ -57,7 +57,7 @@ from .patching import (
57
57
  unpatch_sklearn,
58
58
  )
59
59
 
60
- __version__ = "0.1.2"
60
+ __version__ = "0.1.3"
61
61
 
62
62
  __all__ = [
63
63
  # patching