incremental_learner.knefmnn

Enhanced fuzzy min-max neural network classifier with k-nearest hyperboxes expansion rules trained by the incremental learning algorithm.

class hbbrain.numerical_data.incremental_learner.knefmnn.KNEFMNNClassifier(theta=0.5, gamma=1, k_neighbors=5, is_draw=False, V=None, W=None, C=None)[source]

Bases: BaseFMNNClassifier

Enhanced fuzzy min-max neural network classifier with k-nearest hyperboxes expansion rules using the incremental learning algorithm.

This class implements the enhanced online learning algorithm with k-nearest hyperboxes expansion rules to train the Simpson’s fuzzy min-max neural network. Rather than creating a new hyperbox when the selected winner hyperbox is not satisfied with the expansion condition as in the enhanced fuzzy min-max neural network, this algorithm considers up to k winner hyperboxes. The creation of a new hyperbox only happens when all k selected winner hyperboxes cannot be extended to cover the input pattern. The details of this algorithm can be found in [1].

Parameters:
thetafloat, optional, default=0.5

Maximum hyperbox size for numerical features.

gammafloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continuous feature.

k_neighborsint, optional, default = 5

Number of nearest hyperboxes used for in the consideraton of expansion rules.

is_drawboolean, optional, default=False

Whether the construction of hyperboxes can be progressively shown during the training process on a canvas window.

Varray-like of shape (n_hyperboxes, n_features)

A matrix stores all minimal points for numerical features of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_features)

A matrix stores all maximal points for numerical features of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Carray-like of shape (n_hyperboxes,)

A vector stores all class labels correponding to existing hyperboxes.

References

[1]

M. Mohammed and C. P. Lim, “Improving the Fuzzy Min-Max neural network with a k-nearest hyperbox expansion rule for pattern classification,” Applied Soft Computing, vol. 52, pp. 135-145, 2017.

Examples

>>> from sklearn.datasets import load_iris
>>> from hbbrain.numerical_data.incremental_learner.knefmnn import KNEFMNNClassifier
>>> X, y = load_iris(return_X_y=True)
>>> from sklearn.preprocessing import MinMaxScaler
>>> scaler = MinMaxScaler()
>>> scaler.fit(X)
MinMaxScaler()
>>> X = scaler.transform(X)
>>> clf = KNEFMNNClassifier(theta=0.1, k_neighbors=5).fit(X, y)
>>> clf.predict(X[[10, 50, 100]])
array([0, 1, 2])
Attributes:
elapsed_training_timefloat

Training time in seconds.

Methods

delay([delay_constant])

Delay a time period to display hyperboxes

draw_hyperbox_and_boundary([window_name, ...])

Draw the existing hyperboxes and their decision boundaries among classes

fit(X, y)

Fit the model according to the given training data using the enhanced online learning algorithm with the k-nearest hyperbox selection rule.

get_n_hyperboxes()

Get number of hyperboxes in the trained hyperbox-based model

get_params([deep])

Get parameters for this estimator.

get_sample_explanation(x)

Get useful information for explaining the reason behind the predicted result for the input pattern

initialise_canvas_graph([n_dims, ...])

Initialise a canvas to draw hyperboxes

predict(X)

Predict class labels for samples in X.

predict_proba(X)

Predict class probabilities of the input samples X.

predict_with_membership(X)

Predict class membership values of the input samples X.

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.

show_sample_explanation(xl, xu, ...[, ...])

Show explanation for predicted results of an input pattern under the form of parallel coordinates or hyperboxes in 2D or 3D planes.

simple_pruning(X_val, y_val[, ...])

Simply prune low qualitied hyperboxes based on a pre-defined accuracy threshold for each hyperbox

fit(X, y)[source]

Fit the model according to the given training data using the enhanced online learning algorithm with the k-nearest hyperbox selection rule.

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

Training vector, where n_samples is the number of samples and n_features is the number of features.

yarray-like of shape (n_samples,)

Target vector relative to X.

Returns:
selfobject

Fitted fuzzy min-max neural network.