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,12 +55,11 @@ 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:
lloyd_iter = lloyd_iter_chunked_dense
_inertia = _inertia_dense
# 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
strict_convergence = False
......
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