Commit 6bd854ca authored by Julien Jerphanion's avatar Julien Jerphanion

Adapt front-end

parent a041ca77
import numpy as np
from threadpoolctl import threadpool_limits
from kmeans._kmeans import lloyd_iter_chunked_dense, _inertia_dense
def _kmeans_single_lloyd(X, sample_weight, centers_init, max_iter=300,
verbose=False, x_squared_norms=None, tol=1e-4,
n_threads=1):
......@@ -49,10 +55,9 @@ def _kmeans_single_lloyd(X, sample_weight, centers_init, max_iter=300,
weight_in_clusters = np.zeros(n_clusters, dtype=X.dtype)
center_shift = np.zeros(n_clusters, dtype=X.dtype)
if sp.issparse(X):
lloyd_iter = lloyd_iter_chunked_sparse
_inertia = _inertia_sparse
else:
# NOTE: We only rely on dense array for those analysis
if sample_weight is None:
sample_weight = np.ones((X.shape[0],), dtype=X.dtype)
lloyd_iter = lloyd_iter_chunked_dense
_inertia = _inertia_dense
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment