Scikit-learn --- 5. Clustering Model

(A) General method parameters

1. General procedure

  • get_params([deep]): Returns the parameters of the model.

    • deep: If Trueyou 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 a numpy array, each row represents a sample and each column represents one feature.
    • y: Label sample collection. It and Xeach 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 a numpy 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 a numpy array, each row represents a sample and each column represents one feature.
    • y: Label sample collection. It and Xeach row corresponds to.
    • sample_weight: Weight of the sample weight. Its shape [n_samples,], each element represents a sample weight.
  • transform(X): The data set  X switch to cluster center space .

    In cluster center space dimensions, the sample is its distance from the center of each cluster.

    • X: Sample set. Typically a numpy 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 set  X switch to cluster center space .

    • X: Sample set. Typically a numpy array, each row represents a sample and each column represents one feature.
    • y: Label sample collection. It and Xeach 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 specified  CPUnumber.

    If  -1 you use all available  CPU.

  • 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 Nonedisables the log output.
  • max_iter : An integer specifying the maximum number of iterations.

    If Nonecompared to the default value (different solverdifferent default value).

  • tol: A floating-point number, specify a threshold algorithm converges.

  • random_state: An integer or a RandomStateinstance, or None.

    • If an integer, it specifies the random number seed generator.
    • If as RandomStatean example, it specifies the random number generator.
    • If it is None, then the default random number generator.

A, KMeans

Two, DBSCAN

Three, MeanShift

Four, AgglomerativeClustering

Five, BIRCH

六、GaussianMixture

七、SpectralClustering

Guess you like

Origin www.cnblogs.com/nxf-rabbit75/p/12109346.html