autoqild.mi_estimators.mi_base_classΒΆ

Base class for all Mutual Information estimators.

Classes

MIEstimatorBase(n_classes, n_features, ...)

class autoqild.mi_estimators.mi_base_class.MIEstimatorBase(n_classes, n_features, random_state)[source]ΒΆ

Bases: BaseEstimator, ClassifierMixin

decision_function(X, verbose=0)[source]ΒΆ

Predict confidence scores for samples, sometimes conincciding with the probability scores in X. The confidence score for a sample is proportional to the signed distance of that sample to the hyperplane.

Parameters:

X (array-like of shape (n_samples, n_features)) – Input samples.

Returns:

y_proba – Predicted class probabilities.

Return type:

array-like of shape (n_samples, n_classes)

Raises:

NotImplementedError – If the method is not implemented by the subclass.

estimate_mi(X, y, **kwargs)[source]ΒΆ

Estimate Mutual Information using the specified method.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Input data.

  • y (array-like of shape (n_samples,)) – Target labels.

  • **kwargs (dict, optional) – Additional keyword arguments passed to the estimation methods.

Returns:

mutual_information – A mean of estimated MI values from cross-validation splits.

Return type:

float

Raises:

NotImplementedError – If the method is not implemented by the subclass.

fit(**kwd)[source]ΒΆ

Fit the mutual information estimation model to the data.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Training data.

  • y (array-like of shape (n_samples,)) – Target labels.

  • **kwd (dict, optional) – Additional keyword arguments passed to the fit method of the classifier.

Returns:

self – Fitted estimator.

Return type:

object

get_params(deep=True)[source]ΒΆ

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

predict(X, verbose=0)[source]ΒΆ

Predict class labels for samples in X.

Parameters:

X (array-like of shape (n_samples, n_features)) – Input samples.

Returns:

y_pred – Predicted class labels.

Return type:

array-like of shape (n_samples,)

Raises:

NotImplementedError – If the method is not implemented by the subclass.

predict_proba(X, verbose=0)[source]ΒΆ

Predict class probabilities for samples in X.

Parameters:

X (array-like of shape (n_samples, n_features)) – Input samples.

Returns:

y_proba – Predicted class probabilities.

Return type:

array-like of shape (n_samples, n_classes)

Raises:

NotImplementedError – If the method is not implemented by the subclass.

score(X, y, sample_weight=None, verbose=0)[source]ΒΆ

Return the score based on the metric on the given test data and labels.

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) w.r.t. y.

Return type:

float

Raises:

NotImplementedError – If the method is not implemented by the subclass.

set_params(**parameters)[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:

**params (dict) – Estimator parameters.

Returns:

self – Estimator instance.

Return type:

estimator instance