scikit learn - _SOLVED_ Impossible to set the gamma parameter for the spectral_clustering function in sklearn 0.18.1 -


i doing clustering using scikit-learn (aka sklearn) , worked fine until tried play gamma parameter of spectral_clustering function.

i using sklearn (0.18.1) python (3.5.2) in virtual environment manage anaconda (1.5.1).

in official documentation of function, there mention of parameter gamma :

class sklearn.cluster.spectralclustering(n_clusters=8, eigen_solver=none, random_state=none, n_init=10, gamma=1.0, affinity='rbf', n_neighbors=10, eigen_tol=0.0, assign_labels='kmeans', degree=3, coef0=1, kernel_params=none, n_jobs=1)

however, on machine when try pass parameter gamma function, following error :

typeerror: spectral_clustering() got unexpected keyword argument 'gamma'

and then, when display page of function help(spectral_clustering), got different information on official documentation :

spectral_clustering(affinity, n_clusters=8, n_components=none, eigen_solver=none, random_state=none, n_init=10, eigen_tol=0.0, assign_labels='kmeans')

it parameters mising. thought maybe coming conda package installing pip doesn't solve problem.

i tried install outside of virtual environment , still similar problem.

however, asked 2 of colleagues , 1 had same problem me while other 1 see same information in help(spectral_clustering) function in official documentation.

how can same functionalities in official documentation ?

edit : using spectral_clustering function in 1 of pipeline following :

if clt_mtd == 'spectral':     # spectral clustering     labels = spectral_clustering(sm, n_clusters=num_clt, random_state=seed, gamma=0.1) 

this function working fine long don't try modify gamma parameter.

edit 2 : mistake coming one of official example used reference.

solution : discussed in commentaries below, spectralclustering , spectral_clustering not same. last 1 used function fit in class spectralclustering , doesn't take gamma parameter 1 used before in function fit.

therefore, able modify gamma parameter 1 should instantiate spectralclustering object first , use function fit provided class.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -