wlearn-cluster Python
Python estimator wrapper for the wlearn C11 clustering core.
Install
pip install wlearn-cluster
Example
from wlearn_cluster import ClusterModel, silhouette, adjusted_rand
model = ClusterModel({"method": "kmeans", "k": 3, "seed": 42})
model.fit(X)
labels = model.labels
score = silhouette(X, labels)
model.save("cluster.wlrn")
restored = ClusterModel.load("cluster.wlrn")
API
ClusterModel(params=None)orClusterModel.create(params).fit(X)trainskmeans,minibatch,dbscan,hierarchical, orfastpam.predict(X)assigns new rows for centroid/medoid methods.score(X)returns silhouette score for fitted labels.save(path=None)returns WLRN bytes and writes them when given astrorPath.ClusterModel.load(bytes_or_path)accepts WLRN bytes,str, orPath.get_params()/set_params(...)support estimator cloning/search.default_search_space()returns the AutoML search-space IR.dispose()releases native memory early in long-running processes.
Fitted properties: labels, centers, medoid_indices, medoid_coords,
core_mask, dendrogram, n_samples, n_features, n_clusters, n_iter,
n_noise, inertia, method, is_fitted, capabilities.
Standalone metrics: silhouette, calinski_harabasz, davies_bouldin,
adjusted_rand.
save() returns a WLRN bundle. Native cluster bytes are an internal artifact
inside the bundle, matching JavaScript @wlearn/cluster.
Development
The canonical native source is repository root src/; py/csrc/ is generated
for Python builds. make test-py uses fixtures and has no sklearn dependency.
Use make test-py-ref for optional external parity tests.
Metadata
Release files for wlearn-cluster 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wlearn_cluster-0.1.0.tar.gz | 26.9 kB | Details |
Release files / wlearn_cluster-0.1.0.tar.gz
| Download URL | wlearn_cluster-0.1.0.tar.gz |
|---|---|
| Size | 26.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16de7f7dfb313a074c3df9b2366f11f2182540c492b47687593e9e3324e85c96
|
|
BLAKE2b-256 checksum How to use checksums |
d28656f430e44ec82188f0d806a892d1437054ade6fa6505fe9bee6bfe2ae3e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|