deepmol.imbalanced_learn package

Submodules

deepmol.imbalanced_learn.imbalanced_learn module

class ClusterCentroids(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None, estimator: callable = KMeans(), voting: str = 'auto')[source]

Bases: ImbalancedLearn

Class to perform ClusterCentroids under-sampling. Wrapper around ImbalancedLearn ClusterCentroids (https://imbalanced-learn.org/stable/generated/imblearn.under_sampling.ClusterCentroids.html) Perform under-sampling by generating centroids based on clustering.

class ImbalancedLearn[source]

Bases: ABC

Class for dealing with imbalanced datasets. A ImbalancedLearn sampler receives a Dataset object and performs over/under sampling. Subclasses need to implement a _sample method to perform over/under sampling.

sample(dataset: Dataset) Dataset[source]

Sample the dataset according to the sampling strategy. :param dataset: Dataset to sample. :type dataset: Dataset

Returns:

dataset – Sampled dataset.

Return type:

Dataset

class RandomOverSampler(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None)[source]

Bases: ImbalancedLearn

Class to perform naive random over-sampling. Wrapper around ImbalancedLearn RandomOverSampler (https://imbalanced-learn.readthedocs.io/en/stable/generated/imblearn.over_sampling.RandomOverSampler.html) Object to over-sample the minority class(es) by picking samples at random with replacement.

class RandomUnderSampler(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None, replacement: bool = False)[source]

Bases: ImbalancedLearn

Class to perform RandomUnderSampler under-sampling. Wrapper around ImbalancedLearn RandomUnderSampler (https://imbalanced-learn.org/stable/generated/imblearn.under_sampling.RandomUnderSampler.html) Under-sample the majority class(es) by randomly picking samples with or without replacement.

class SMOTE(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None, k_neighbors: int = 5, n_jobs: int | None = None)[source]

Bases: ImbalancedLearn

Class to perform Synthetic Minority Oversampling Technique (SMOTE) over-sampling. Wrapper around ImbalancedLearn SMOTE (https://imbalanced-learn.org/stable/generated/imblearn.over_sampling.SMOTE.html)

class SMOTEENN(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None, smote: callable | None = None, enn: callable | None = None, n_jobs: int | None = None)[source]

Bases: ImbalancedLearn

Class to perform SMOTEENN over and under-sampling. Wrapper around ImbalancedLearn SMOTEENN (https://imbalanced-learn.org/stable/generated/imblearn.combine.SMOTEENN.html) Over-sampling using SMOTE and cleaning using ENN. Combine over and under-sampling using SMOTE and Edited Nearest Neighbours.

class SMOTETomek(sampling_strategy: float | str | dict | callable = 'auto', random_state: int | RandomState | None = None, smote: callable | None = None, tomek: callable | None = None, n_jobs: int | None = None)[source]

Bases: ImbalancedLearn

Class to perform SMOTETomek over and under-sampling. Wrapper around ImbalancedLearn SMOTETomek (https://imbalanced-learn.org/stable/generated/imblearn.combine.SMOTETomek.html) Over-sampling using SMOTE and cleaning using Tomek links. Combine over- and under-sampling using SMOTE and Tomek links.

Module contents