'check_array() got an unexpected keyword argument 'warn_on_dtype'

so I'm trying to do Co-clustering Mod for my data, here is the code:

from coclust.visualization import (plot_reorganized_matrix,
                                  plot_cluster_top_terms,
                                  plot_max_modularities)
from coclust.evaluation.internal import best_modularity_partition
from coclust.coclustering import CoclustMod


# get the best co-clustering over a range of cluster numbers
clusters_range = range(2, 6)
model, modularities = best_modularity_partition(X_count_scaled, clusters_range, n_rand_init=1)

# plot the reorganized matrix
plot_reorganized_matrix(X_count_scaled, model)

# plot the top terms
n_terms = 10
plot_cluster_top_terms(X_count_scaled, uni_true_labels, n_terms, model)

# plot the modularities over the range of cluster numbers
plot_max_modularities(modularities, range(2, 6))

and I keep getting the error:

<ipython-input-56-969f8dc34730> in <module>
      8 # get the best co-clustering over a range of cluster numbers
      9 clusters_range = range(2, 6)
---> 10 model, modularities = best_modularity_partition(X_count, clusters_range, n_rand_init=1)
     11 
     12 # plot the reorganized matrix

~\anaconda3\lib\site-packages\coclust\evaluation\internal.py in best_modularity_partition(in_data, nbr_clusters_range, n_rand_init)
     45         tmp_model = CoclustMod(n_clusters=tmp_n_clusters, n_init=n_rand_init,
     46                                random_state=0)
---> 47         tmp_model.fit(in_data)
     48 
     49         modularity_end = tmp_model.modularity

~\anaconda3\lib\site-packages\coclust\coclustering\coclust_mod.py in fit(self, X, y)
     91         random_state = check_random_state(self.random_state)
     92 
---> 93         check_array(X, accept_sparse=True, dtype="numeric", order=None,
     94                     copy=False, force_all_finite=True, ensure_2d=True,
     95                     allow_nd=False, ensure_min_samples=self.n_clusters,

~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
     61             extra_args = len(args) - len(all_args)
     62             if extra_args <= 0:
---> 63                 return f(*args, **kwargs)
     64 
     65             # extra_args > 0

TypeError: check_array() got an unexpected keyword argument 'warn_on_dtype'

So i went to the the file in my anacondas3 : ~\anaconda3\lib\site-packages\coclust\coclustering\coclust_mod.py and i modified check_array() by deleting the warn_on_dtype....but I still get the same error :/

Ps: the type of my data (X_count_scaled) is numpy.ndarray and i tried the same code with the scipy.sparse.csr.csr_matrix version of my data and i still get the same error :/...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source