pyoselm.elm.GenELMClassifier¶
-
class
pyoselm.elm.GenELMClassifier(hidden_layer=None, binarizer=None, regressor=None)[source]¶ Classification model based on Extreme Learning Machine. Internally, it uses a GenELMRegressor.
- Parameters
hidden_layer (random_layer instance, optional) – (default=MLPRandomLayer(random_state=0))
binarizer (LabelBinarizer, optional) – (default=sklearn.preprocessing.LabelBinarizer(-1, 1))
regressor (regressor instance, optional) – (default=LinearRegression()) Used to perform the regression from hidden unit activations to the outputs and subsequent predictions.
-
`classes_` Array of class labels
- Type
numpy array of shape [n_classes]
-
`genelm_regressor_` Performs actual fit of binarized values
- Type
ELMRegressor instance
See also
GenELMRegressor,ELMClassifier,MLPRandomLayer-
__init__(hidden_layer=None, binarizer=None, regressor=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__([hidden_layer, binarizer, regressor])Initialize self.
This function return the decision function values related to each class on an array of test vectors X.
fit(X, y)Fit the model using X, y as training data.
get_params([deep])Get parameters for this estimator.
predict(X)Predict values using the model
score(X, y[, sample_weight])Return the mean accuracy on the given test data and labels.
set_params(**params)Set the parameters of this estimator.
Attributes
Check if model was fitted
-
decision_function(X)[source]¶ This function return the decision function values related to each class on an array of test vectors X.
- Parameters
X (array-like of shape [n_samples, n_features]) –
- Returns
C – Decision function values related to each class, per sample. In the two-class case, the shape is [n_samples,]
- Return type
array of shape [n_samples, n_classes] or [n_samples,]
-
fit(X, y)[source]¶ Fit the model using X, y as training data.
- Parameters
X ({array-like, sparse matrix} of shape [n_samples, n_features]) – Training vectors, where n_samples is the number of samples and n_features is the number of features.
y (array-like of shape [n_samples, n_outputs]) – Target values (class labels in classification, real numbers in regression)
- Returns
self – Returns an instance of self.
- Return type
object
-
get_params(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
dict
-
property
is_fitted¶ Check if model was fitted
- Returns
- Return type
boolean, True if model is fitted
-
predict(X)[source]¶ Predict values using the model
- Parameters
X ({array-like, sparse matrix} of shape [n_samples, n_features]) –
- Returns
C – Predicted values.
- Return type
numpy array of shape [n_samples, n_outputs]
-
score(X, y, sample_weight=None)¶ Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
- Parameters
X (array-like of shape (n_samples, n_features)) – Test samples.
y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.
sample_weight (array-like of shape (n_samples,), default=None) – Sample weights.
- Returns
score – Mean accuracy of
self.predict(X)wrt. y.- Return type
float
-
set_params(**params)¶ 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
**params (dict) – Estimator parameters.
- Returns
self – Estimator instance.
- Return type
estimator instance