lale.lib.autogen.nearest_centroid module

class lale.lib.autogen.nearest_centroid.NearestCentroid(*, metric='euclidean', shrink_threshold=None)

Bases: PlannedIndividualOp

Combined schema for expected data and hyperparameters.

This documentation is auto-generated from JSON schemas.

Parameters
  • metric (union type, default 'euclidean') –

    The metric to use when calculating distance between instances in a feature array

    • callable, not for optimizer

    • or ‘cityblock’, ‘cosine’, ‘euclidean’, ‘l1’, ‘l2’, ‘manhattan’, ‘braycurtis’, ‘canberra’, ‘chebyshev’, ‘correlation’, ‘dice’, ‘hamming’, ‘jaccard’, ‘kulsinski’, ‘mahalanobis’, ‘minkowski’, ‘rogerstanimoto’, ‘russellrao’, ‘seuclidean’, ‘sokalmichener’, ‘sokalsneath’, ‘sqeuclidean’, or ‘yule’

  • shrink_threshold (union type, default None) –

    Threshold for shrinking centroids to remove features.

    • float, >=0.0 for optimizer, <=1.0 for optimizer, uniform distribution

    • or None

    See also constraint-1.

Notes

constraint-1 : union type

threshold shrinking not supported for sparse input

  • negated type of ‘X/isSparse’

  • or shrink_threshold : None

fit(X, y=None, **fit_params)

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Training vector, where n_samples is the number of samples and n_features is the number of features

  • y (array of items : float) – Target values (integers)

predict(X, **predict_params)

Make predictions.

Note: The predict method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array of items : array of items : float) –

Returns

result – Perform classification on an array of test vectors X.

Return type

array of items : float