When I import the function check_array from module sklearn.utils.validation, it got an Import Error (ImportError: cannot import name check_array).
The tab completion got check_arrays, but I'm wondering there only exists a function called check_array in validation.py ( source code on Github).
Besides, the spectral clustering algorithm implemented in scikit-learn/sklearn/cluster/spectral.py also used from ..utils.validation import check_array, not check_arrays.
I'm quite confused about this, and my scikit-learn version is '0.15.0b1'. Hope somebody gives me a clue.
import numpy as np
from sklearn.utils.validation import check_array
def my_fit_affinity(X, affinity_type, n_neighbors, **kernel_params):
    """ Create an affinity matrix for X using the selected affinity type
    """    
    X = check_array(X, accept_sparse = ['csr', 'csc', 'coo']) 
    ....
    return affinity_matrix_
                If you use jupyter notebook, try restarting your kernel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With