lale.lib.imblearn.smoteenn module

class lale.lib.imblearn.smoteenn.SMOTEENN(*, operator, sampling_strategy='auto', random_state=None, smote=None, enn=None)

Bases: PlannedIndividualOp

Class to perform over-sampling using SMOTE and cleaning using ENN.

This documentation is auto-generated from JSON schemas.

Combine over- and under-sampling using SMOTE and Edited Nearest Neighbours.

Parameters
  • operator (operator, optional) –

    Trainable Lale pipeline that is trained using the data obtained from the current imbalance corrector.

    Predict, transform, predict_proba or decision_function would just be forwarded to the trained pipeline. If operator is a Planned pipeline, the current imbalance corrector can’t be trained without using an optimizer to choose a trainable operator first. Please refer to lale/examples for more examples.

  • sampling_strategy (union type, optional, not for optimizer, default 'auto') –

    Sampling information to resample the data set.

    • float, not for optimizer

      Desired ratio of the number of samples in the minority class over the number of samples in the majority class after resampling. Therefore, the ratio is expressed as \alpha_{os} =
N_{rm} / N_{M} where N_{rm} is the number of samples in the minority class after resampling and N_{M} is the number of samples in the majority class.

      Warning

      Only available for binary classification. An error is raised for multi-class classification.

    • or ‘minority’, ‘not minority’, ‘not majority’, ‘all’, or ‘auto’

      The class targeted by the resampling. The number of samples in the different classes will be equalized. Possible choices are:

      • 'minority': resample only the minority class;

      • 'not minority': resample all classes but the minority class;

      • 'not majority': resample all classes but the majority class;

      • 'all': resample all classes;

      • 'auto': equivalent to 'not majority'.

    • or dict, not for optimizer

      Keys correspond to the targeted classes and values correspond to the desired number of samples for each targeted class.

    • or callable, not for optimizer

      Function taking y and returns a dict. The keys correspond to the targeted classes and the values correspond to the desired number of samples for each class.

  • random_state (union type, optional, not for optimizer, default None) –

    Control the randomization of the algorithm.

    • None

      RandomState used by np.random

    • or integer

      The seed used by the random number generator

    • or numpy.random.RandomState

      Random number generator instance.

  • smote (union type, optional, not for optimizer, default None) –

    The imblearn.over_sampling.SMOTE object to use. If not given, a imblearn.over_sampling.SMOTE object with default parameters will be given.

    • Any

    • or None

  • enn (union type, optional, not for optimizer, default None) –

    The imblearn.under_sampling.EditedNearestNeighbours object to use. If not given, a imblearn.under_sampling.EditedNearestNeighbours object with sampling strategy=’all’ will be given.

    • Any

    • or None

decision_function(X)

Confidence scores for all classes.

Note: The decision_function 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) – Features; the outer array is over samples.

Returns

result – Output data schema for predictions.

Return type

Any

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) – Features; the outer array is over samples.

  • y (union type) –

    Target class labels; the array is over samples.

    • array of items : float

    • or array of items : string

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) – Features; the outer array is over samples.

Returns

result – Output data schema for predictions.

Return type

Any

predict_proba(X)

Probability estimates for all classes.

Note: The predict_proba 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) – Features; the outer array is over samples.

Returns

result – Probability of the sample for each class in the model.

Return type

array of items : array of items : float

transform(X, y=None)

Transform the data.

Note: The transform 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) – Features; the outer array is over samples.

  • y (union type) –

    Target class labels; the array is over samples.

    • array of items : float

    • or array of items : string

    • or None

Returns

result – Output data schema for transformed data.

Return type

Any