Python~TypeError: fit() missing 1 required positional argument: ‘X‘

错误代码

from sklearn import datasets as dss
from sklearn.cluster import SpectralClustering
X, y = dss.make_circles(n_samples=1000, noise=0.05, factor=0.5)
scm_1 = SpectralClustering()
scm_1.fit()		# 错误代码

错误提示

TypeError: fit() missing 1 required positional argument: 'X'

正确代码

from sklearn import datasets as dss
from sklearn.cluster import SpectralClustering
X, y = dss.make_circles(n_samples=1000, noise=0.05, factor=0.5)
scm_1 = SpectralClustering()
# scm_1.fit()		# 错误代码
scm_1.fit(X)		# 正确代码

你可能感兴趣的:(Error,&,Warring,python)