SimpleVote¶
- class tsml_eval.estimators.clustering.consensus.SimpleVote(clusterers=None, n_clusters=8, random_state=None)[source]¶
SimpleVote clustering ensemble.
SimpleVote is a clustering ensemble that uses a voting scheme to combine the results of multiple clusterers.
- Parameters:
- clustererslist of clusterers, default=None
A list of clusterers to use in the ensemble. If None, defaults to 5 KMeans clusterers.
- n_clustersint, default=8
The number of clusters to form.
- random_stateint, default=None
The seed for random number generation.
Examples
>>> from tsml_eval.estimators.clustering.consensus.simple_vote import SimpleVote >>> from sklearn.datasets import load_iris >>> from sklearn.metrics import rand_score >>> iris = load_iris() >>> sv = SimpleVote(n_clusters=3, random_state=0) >>> sv.fit(iris.data) SimpleVote(...) >>> rand_score(iris.target, sv.labels_) 0.8737360178970918
- Attributes:
- labels_ndarray of shape (n_instances,)
Labels of each point from the last fit.
Methods
fit(X[, y])Fit model to X using a simple vote ensemble.
fit_predict(X[, y])Perform clustering on X and returns cluster labels.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict(X)Predict cluster labels for X.
Predict cluster probabilities for X.
set_params(**params)Set the parameters of this estimator.
- fit_predict(X, y=None, **kwargs)[source]¶
Perform clustering on X and returns cluster labels.
- Parameters:
- Xarray-like of shape (n_samples, n_features)
Input data.
- yIgnored
Not used, present for API consistency by convention.
- **kwargsdict
Arguments to be passed to
fit.Added in version 1.4.
- Returns:
- labelsndarray of shape (n_samples,), dtype=np.int64
Cluster labels.
- get_metadata_routing()[source]¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- get_params(deep=True)[source]¶
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- set_params(**params)[source]¶
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.