Learning materials for Scikit-learn bags

Source: Internet
Author: User

Http://scikit-learn.org/stable/modules/clustering.html#k-means

http://my.oschina.net/u/175377/blog/84420

K-means Clustering Parameter Description:

Http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html#sklearn.cluster.KMeans

class Sklearn.cluster. Kmeans (n_clusters=8, init= ' k-means++ ', n_init=10, max_iter=300, tol= 0.0001,precompute_distances= ' auto ', verbose=0, random_state=none, copy _x=true, n_jobs=1)

n_clusters : int, optional, default:8

The number of clusters to form as well as the number of centroids to generate.

max_iter : int, default:300

Maximum number of iterations of the K-means algorithm for a single run.

n_init : int, default:10

Number of time the K-means algorithm would be run with different centroid seeds. The final results be is the best output of n_init consecutive runs in terms of inertia.

init : {' k-means++ ', ' random ' or an ndarray}

Method for initialization, defaults to ' k-means++ ':

' k-means++ ': Selects initial cluster Centers for K-mean clustering in a smart-to-speed-up convergence. See sections Notes in K_init for more details.

' Random ': Choose K Observations (rows) at random from data for the initial centroids.

If an Ndarray are passed, it should be of shape (n_clusters, n_features) and gives the initial centers.

precompute_distances : {' auto ', True, False}

Precompute distances (faster but takes more memory).

' Auto ': Do not precompute distances if n_samples * n_clusters > million. This corresponds to about 100MB overhead per job using a double precision.

True:always Precompute Distances

False:never Precompute Distances

tol : float, default:1e-4

Relative tolerance with regards to inertia to declare convergence

n_jobs : int

The number of jobs to use for the computation. This works by computing each of the n_init runs in parallel.

If-1 all CPUs is used. If 1 is given, no parallel computing code was used at all, and which is useful for debugging. For N_jobs Below-1, (N_cpus + 1 + n_jobs) is used. Thus for n_jobs =-2, all CPUs but one is used.

random_state : Integer or NumPy. Randomstate, optional

The generator used to initialize the centers. If An integer is given, it fixes the seed. Defaults to the global numpy random number generator.

verbose : int, default 0

verbosity mode.

copy_x  : boolean, default True

blockquote>

When pre-computing distances it was more numerically accurate to center the data first. If copy_x is True and then the original data was not modified. If False, the original data is modified, and put back before the function returns, but small numerical differences could be Introduced by subtracting and then adding the data mean.

Cluster_centers_: Array, [N_clusters, N_features]

Coordinates of cluster centers

Labels_::

Labels of each point

Inertia_: Float

Sum of distances of samples to their closest cluster center.

Learning materials for Scikit-learn bags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.