jsat.classifiers.imbalance
Class BorderlineSMOTE
- java.lang.Object
-
- jsat.classifiers.imbalance.SMOTE
-
- jsat.classifiers.imbalance.BorderlineSMOTE
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
public class BorderlineSMOTE extends SMOTE
This class implements the Borderline extension of theSMOTEalgorithm for dealing with class imbalance. SMOTE over-samples from the minority class at random points in the space. Borderline smote attempts to estimate which points are on the border of the class bounder, and over-samples only from the points on the boarder. Boarderline-SMOTE can also choose toperform interpolation using samples for the majority class, which can sometimes improve performance. The border is impacted by changes to the number ofneighborsused. In the rare event that a boarder can't be estimated, this implementation will fall back to standard SMOTE.
This implementation extends the original SMOTE algorithm to the multi-class case.
See: Han, H., Wang, W.-Y., & Mao, B.-H. (2005). Borderline-SMOTE: A New Over-sampling Method in Imbalanced Data Sets Learning. In Proceedings of the 2005 International Conference on Advances in Intelligent Computing - Volume Part I (pp. 878–887). Berlin, Heidelberg: Springer-Verlag. DOI:10.1007/11538059_91- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BorderlineSMOTE(BorderlineSMOTE toCopy)Copy constructorBorderlineSMOTE(Classifier baseClassifier)Creates a new Borderline-SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class.BorderlineSMOTE(Classifier baseClassifier, boolean majorityInterpolation)Creates a new Borderline-SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class.BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, boolean majorityInterpolation)Creates a new Borderline-SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class.BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, double targetRatio, boolean majorityInterpolation)Creates a new Borderline-SMOTE model.BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, int smoteNeighbors, double targetRatio, boolean majorityInterpolation)Creates a new SMOTE object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description BorderlineSMOTEclone()booleanisMajorityInterpolation()voidsetMajorityInterpolation(boolean majorityInterpolation)Sets whether the generation of synthetic samples can make use of the majority samples (i.e., from other classes) or not.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class jsat.classifiers.imbalance.SMOTE
classify, getBaseClassifier, getDistanceMetric, getSmoteNeighbors, getTargetRatio, setBaseClassifier, setDistanceMetric, setSmoteNeighbors, setTargetRatio, supportsWeightedData, train
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
BorderlineSMOTE
public BorderlineSMOTE(Classifier baseClassifier)
Creates a new Borderline-SMOTE model that will over-sample the minority classes so that there is a balanced number of data points in each class. It will not use majority interpolation.- Parameters:
baseClassifier- the base classifier to use after the SMOTEing is done.
-
BorderlineSMOTE
public BorderlineSMOTE(Classifier baseClassifier, boolean majorityInterpolation)
Creates a new Borderline-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.majorityInterpolation-trueif synthetic examples should use the majority class as well, orfalseto use only the minority class.
-
BorderlineSMOTE
public BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, boolean majorityInterpolation)
Creates a new Borderline-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 neighborsmajorityInterpolation-trueif synthetic examples should use the majority class as well, orfalseto use only the minority class.
-
BorderlineSMOTE
public BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, double targetRatio, boolean majorityInterpolation)
Creates a new Borderline-SMOTE model.- Parameters:
baseClassifier- the base classifier to use after the SMOTEing is done.dm- the distance metric to use for determining nearest neighborstargetRatio- the desired ratio of samples for each class with respect to the majority class.majorityInterpolation-trueif synthetic examples should use the majority class as well, orfalseto use only the minority class.
-
BorderlineSMOTE
public BorderlineSMOTE(Classifier baseClassifier, DistanceMetric dm, int smoteNeighbors, double targetRatio, boolean majorityInterpolation)
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 neighborssmoteNeighbors- the number of neighbors to look at when interpolating pointstargetRatio- the desired ratio of samples for each class with respect to the majority class.majorityInterpolation-trueif synthetic examples should use the majority class as well, orfalseto use only the minority class.
-
BorderlineSMOTE
public BorderlineSMOTE(BorderlineSMOTE toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setMajorityInterpolation
public void setMajorityInterpolation(boolean majorityInterpolation)
Sets whether the generation of synthetic samples can make use of the majority samples (i.e., from other classes) or not. The use of majority samples is "Borderline-SMOTE2" in the original paper. If majority samples are not used, it is equivalent to "Borderline-SMOTE1".- Parameters:
majorityInterpolation-trueif majority samples should be used for interpolation, andfalseif only minority samples should be used.
-
isMajorityInterpolation
public boolean isMajorityInterpolation()
- Returns:
trueif majority samples should be used for interpolation, andfalseif only minority samples should be used.
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains 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:
trainin interfaceClassifier- Overrides:
trainin classSMOTE- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
clone
public BorderlineSMOTE clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classSMOTE
-
-
DataMelt 3.0 © DataMelt by jWork.ORG