Closed sgerbe closed 1 year ago
Trying to use sknetwork.clustering.KMeans() with an numpy.ndarray gives me a ValueError: Different number of diagonals and offsets.
kmeans = KMeans(n_clusters=nclust) labels = kmeans.fit_transform(adjacency) # adjacency is type numpy.ndarray
This fixes the problem:
adjacency = sparse.csr_matrix(adjacency) kmeans = KMeans(n_clusters=nclust) labels = kmeans.fit_transform(adjacency) # adjacency is type numpy.ndarray
I am guessing KMeans.fit() does not assign the check_format back to the input matrix:
Is (Line 113):
self._init_vars() # input check_format(input_matrix)
Maybe should be:
self._init_vars() # input input_matrix = check_format(input_matrix)
Thanks for the notice! This has be fixed on the Develop branch.
Description
Trying to use sknetwork.clustering.KMeans() with an numpy.ndarray gives me a ValueError: Different number of diagonals and offsets.
What I Did
This fixes the problem:
I am guessing KMeans.fit() does not assign the check_format back to the input matrix:
Is (Line 113):
Maybe should be: