(A) General method parameters
1. General procedure
-
get_params([deep])
: Returns the parameters of the model.deep
: IfTrue
you can return the child object model parameters.
-
set_params(**params)
: Parameters of the model.params
: Keyword parameters to be set.
-
fit(X[, y, sample_weight])
: Training model.X
: Sample set. Typically anumpy array
, each row represents a sample and each column represents one feature.y
: Label sample collection. It andX
each row corresponds to.sample_weight
: Weight of the sample weight. Its shape[n_samples,]
, each element represents a sample weight.
-
predict(X, sample_weight)
: Returns the cluster label each sample belongs.X
: Sample set. Typically anumpy array
, each row represents a sample and each column represents one feature.sample_weight
: Weight of the sample weight. Its shape[n_samples,]
, each element represents a sample weight.
-
fit_predict(X[, y, sample_weight])
: Training model and implement cluster, returns cluster label each sample belongs.X
: Sample set. Typically anumpy array
, each row represents a sample and each column represents one feature.y
: Label sample collection. It andX
each row corresponds to.sample_weight
: Weight of the sample weight. Its shape[n_samples,]
, each element represents a sample weight.
-
transform(X)
: The data setX
switch tocluster center space
.In
cluster center space
dimensions, the sample is its distance from the center of each cluster.X
: Sample set. Typically anumpy array
, each row represents a sample and each column represents one feature.
-
fit_transform(X[, y, sample_weight])
: Training model and implementation of clustering, the data setX
switch tocluster center space
.X
: Sample set. Typically anumpy array
, each row represents a sample and each column represents one feature.y
: Label sample collection. It andX
each row corresponds to.sample_weight
: Weight of the sample weight. Its shape[n_samples,]
, each element represents a sample weight.
2.通用参数
-
n_jobs
: A positive number, and when the form specified tasks specifiedCPU
number.If
-1
you use all availableCPU
. -
verbose
: A positive number. For opening / closing the intermediate iteration output log function.- The larger the value, the more detailed the log.
- Value of 0 or
None
disables the log output.
-
max_iter
: An integer specifying the maximum number of iterations.If
None
compared to the default value (differentsolver
different default value). -
tol
: A floating-point number, specify a threshold algorithm converges. -
random_state
: An integer or aRandomState
instance, orNone
.- If an integer, it specifies the random number seed generator.
- If as
RandomState
an example, it specifies the random number generator. - If it is
None
, then the default random number generator.