lale.lib.imblearn.condensed_nearest_neighbour module

class lale.lib.imblearn.condensed_nearest_neighbour.CondensedNearestNeighbour(*, operator, sampling_strategy='auto', random_state=None, n_neighbors=None, n_seeds_S=1, n_jobs=1)

Bases: PlannedIndividualOp

Class to perform under-sampling based on the condensed nearest neighbour method.

This documentation is auto-generated from JSON schemas.

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.

    • ’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 union type, not for optimizer

      Classes targeted by the resampling.

      • array of items : float

      • or array of items : string

    • 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.

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

    Number of neighbors.

    • integer

      Number of nearest neighbours to use to construct synthetic samples.

    • or Any

      An estimator that inherits from sklearn.neighbors.base.KNeighborsMixin that will be used to find the n_neighbors.

    • or None

      KNeighborsClassifier(n_neighbors=1)

  • n_seeds_S (integer, optional, not for optimizer, default 1) – Number of samples to extract in order to build the set S.

  • n_jobs (integer, optional, not for optimizer, default 1) – The number of threads to open if possible.

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