tclf.TemplateClassifier

class tclf.TemplateClassifier(demo_param='demo')[source]

An example classifier which implements a 1-NN algorithm.

For more information regarding how to build your own classifier, read more in the User Guide.

Parameters:
demo_paramstr, default=’demo’

A parameter used for demonstation of how to pass and store paramters.

Attributes:
X_ndarray, shape (n_samples, n_features)

The input passed during fit().

y_ndarray, shape (n_samples,)

The labels passed during fit().

classes_ndarray, shape (n_classes,)

The classes seen at fit().

__init__(demo_param='demo')[source]
fit(X, y)[source]

A reference implementation of a fitting function for a classifier.

Parameters:
Xarray-like, shape (n_samples, n_features)

The training input samples.

yarray-like, shape (n_samples,)

The target values. An array of int.

Returns:
selfobject

Returns self.

predict(X)[source]

A reference implementation of a prediction for a classifier.

Parameters:
Xarray-like, shape (n_samples, n_features)

The input samples.

Returns:
yndarray, shape (n_samples,)

The label for each sample is the label of the closest sample seen during fit.

Examples using tclf.TemplateClassifier

Plotting Template Classifier

Plotting Template Classifier