Issue
I am applying scikit-learn's Birch clustering algorithm to the following DataFrame. Using spyder in an anaconda environment.
column1 column2 column3 column4
0 -0.193389 0.064714 -0.244906 0.156697
1 1.679812 -0.106796 0.516472 6.651750
2 0.560031 -0.226183 -0.101638 11.535628
3 2.321758 0.107137 0.263732 1.163682
4 0.099532 -0.168835 0.087254 2.019619
... ... ... ...
17919 -0.360455 -0.243193 -0.244906 -0.397145
17920 -0.357445 -0.237645 -0.244906 -0.397145
17921 -0.352748 -0.228988 -0.244906 -0.397145
17922 -0.353796 -0.230921 -0.244906 -0.346796
17923 -0.341864 -0.208929 -0.244906 -0.397145
The following code throws an error on the screen. I only have a problem with Birch, the rest of the algorithms I am using work correctly: AgglomerativeClustering, GaussianMixtures, Kmeans...
from sklearn.cluster import Birch
brc = Birch(n_clusters=4, threshold=0.15)
cluster_predict = brc.fit_predict(df)
print(cluster_predict)
ValueError: ndarray is not C-contiguous
Running exactly the same code in Google Colab, I get good results.
Solution
It seems to be a bug in scikit-learn version 1.1.1. I haven't looked for a solution. I simply changed to a lower version and it works.
Version 1.1.0 also has the same bug.
Answered By - Carola
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.