Documentation of 'jsat.classifiers.imbalance.SMOTE' Java class
SMOTE
jsat.classifiers.imbalance

Class SMOTE

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
    Direct Known Subclasses:
    BorderlineSMOTE


    public class SMOTE
    extends java.lang.Object
    implements Classifier, Parameterized
    This class implements the Synthetic Minority Over-sampling TEchnique (SMOTE) for dealing with class imbalance. It does this by over-sampling the minority classes to bring their total count up to parity (or some target ratio) with the majority class. This is done by interpolating between minority points and their neighbors to create new synthetic points that are not present in the current dataset. For this reason SMOTE only works with numeric feature vectors.

    See: Chawla, N., Bowyer, K., Hall, L., & Kegelmeyer, P. (2002). SMOTE: synthetic minority over-sampling technique. Artificial Intelligence Research, 16, 321–357. Retrieved from here
    See Also:
    Serialized Form
    • Constructor Detail

      • SMOTE

        public SMOTE(Classifier baseClassifier)
        Creates a new SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class.
        This implementation extends the original SMOTE algorithm to the multi-class case.
        Parameters:
        baseClassifier - the base classifier to use after the SMOTEing is done.
      • SMOTE

        public SMOTE(Classifier baseClassifier,
                     DistanceMetric dm)
        Creates a new SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class.
        Parameters:
        baseClassifier - the base classifier to use after the SMOTEing is done.
        dm - the distance metric to use for determining nearest neighbors
      • SMOTE

        public SMOTE(Classifier baseClassifier,
                     DistanceMetric dm,
                     double targetRatio)
        Creates a new SMOTE model.
        Parameters:
        baseClassifier - the base classifier to use after the SMOTEing is done.
        dm - the distance metric to use for determining nearest neighbors
        targetRatio - the desired ratio of samples for each class with respect to the majority class.
      • SMOTE

        public SMOTE(Classifier baseClassifier,
                     DistanceMetric dm,
                     int smoteNeighbors,
                     double targetRatio)
        Creates a new SMOTE object
        Parameters:
        baseClassifier - the base classifier to use after the SMOTEing is done.
        dm - the distance metric to use for determining nearest neighbors
        smoteNeighbors - the number of neighbors to look at when interpolating points
        targetRatio - the desired ratio of samples for each class with respect to the majority class.
      • SMOTE

        public SMOTE(SMOTE toCopy)
        Copy constructor
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setDistanceMetric

        public void setDistanceMetric(DistanceMetric dm)
        Sets the metric used to determine the nearest neighbors of each point.
        Parameters:
        dm - the distance metric to use.
      • getDistanceMetric

        public DistanceMetric getDistanceMetric()
        Returns:
        the distance metric to use
      • setSmoteNeighbors

        public void setSmoteNeighbors(int smoteNeighbors)
        Sets the number of neighbors that will be used to be candidates for interpolation. The default value recommended in the original paper is 5.
        Parameters:
        smoteNeighbors - the number of candidate neighbors to select from when creating synthetic data points.
      • getSmoteNeighbors

        public int getSmoteNeighbors()
        Returns:
        the number of candidate neighbors to select from when creating synthetic data points.
      • setTargetRatio

        public void setTargetRatio(double targetRatio)
        Sets the desired ratio of samples for each class compared to the majority class. A ratio of 1.0 will oversample the minority classes until they have just as many data points as the majority class. If any minority class already exists at a ratio equal to or above this ratio, no over samples will be created for that class. If the target ratio is greater than one, all classes including the majority class will be over-sampled to the desired ratio.
        Parameters:
        targetRatio - the target ratio between each class and the majority class
      • getTargetRatio

        public double getTargetRatio()
        Returns:
        the target ratio between each class and the majority class
      • setBaseClassifier

        public void setBaseClassifier(Classifier baseClassifier)
        Sets the classifier to use after the dataset has been modified
        Parameters:
        baseClassifier - the classifier to use for training and prediction
      • getBaseClassifier

        public Classifier getBaseClassifier()
        Returns:
        the classifier used by the model
      • classify

        public CategoricalResults classify(DataPoint data)
        Description copied from interface: Classifier
        Performs classification on the given data point.
        Specified by:
        classify in interface Classifier
        Parameters:
        data - the data point to classify
        Returns:
        the results of the classification.
      • train

        public void train(ClassificationDataSet dataSet,
                          boolean parallel)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
        parallel - true if multiple threads should be used to train the model. false if it should be done in a single threaded manner.
      • train

        public void train(ClassificationDataSet dataSet)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
      • supportsWeightedData

        public boolean supportsWeightedData()
        Description copied from interface: Classifier
        Indicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.
        Specified by:
        supportsWeightedData in interface Classifier
        Returns:
        true if the model supports weighted data, false otherwise
      • clone

        public SMOTE clone()
        Specified by:
        clone in interface Classifier
        Overrides:
        clone in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.