Package ai.sklearn4j.preprocessing.label
Class LabelBinarizer
- java.lang.Object
-
- ai.sklearn4j.base.TransformerMixin<List<Object>,NumpyArray<Long>>
-
- ai.sklearn4j.preprocessing.label.LabelBinarizer
-
public class LabelBinarizer extends TransformerMixin<List<Object>,NumpyArray<Long>>
Binarize labels in a one-vs-all fashion. Several regression and binary classification algorithms are available in scikit-learn. A simple way to extend these algorithms to the multi-class classification case is to use the so-called one-vs-all scheme. At learning time, this simply consists in learning one regressor or binary classifier per class. In doing so, one needs to convert multi-class labels to binary labels (belong or does not belong to the class). LabelBinarizer makes this process easy with the transform method. At prediction time, one assigns the class for which the corresponding model gave the greatest confidence. LabelBinarizer makes this easy with the inverse_transform method.
-
-
Constructor Summary
Constructors Constructor Description LabelBinarizer()Instantiate a new object of LabelBinarizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Object>getClasses()Gets the Holds the label for each class.longgetNegativeLabel()Gets the value of NegLabellonggetPositiveLabel()Gets the value of PosLabelStringgetYType()Gets the Represents the type of the target data as evaluated by utils.multiclass.type_of_target.List<Object>inverseTransform(NumpyArray<Long> array)Takes a transformed array and reveres the transformation.voidsetClasses(List<Object> value)Sets the Holds the label for each class.voidsetNegativeLabel(long value)Sets the value of NegLabelvoidsetPositiveLabel(long value)Sets the value of PosLabelvoidsetYType(String value)Sets the Represents the type of the target data as evaluated by utils.multiclass.type_of_target.NumpyArray<Long>transform(List<Object> array)Takes the input array and transforms it.
-
-
-
Method Detail
-
setClasses
public void setClasses(List<Object> value)
Sets the Holds the label for each class.- Parameters:
value- The new value for classes.
-
setYType
public void setYType(String value)
Sets the Represents the type of the target data as evaluated by utils.multiclass.type_of_target. Possible type are 'continuous', 'continuous-multioutput', 'binary', 'multiclass', 'multiclass-multioutput', 'multilabel-indicator', and 'unknown'.- Parameters:
value- The new value for yType.
-
getYType
public String getYType()
Gets the Represents the type of the target data as evaluated by utils.multiclass.type_of_target. Possible type are 'continuous', 'continuous-multioutput', 'binary', 'multiclass', 'multiclass-multioutput', 'multilabel-indicator', and 'unknown'.
-
setNegativeLabel
public void setNegativeLabel(long value)
Sets the value of NegLabel- Parameters:
value- The new value for NegLabel.
-
getNegativeLabel
public long getNegativeLabel()
Gets the value of NegLabel
-
setPositiveLabel
public void setPositiveLabel(long value)
Sets the value of PosLabel- Parameters:
value- The new value for PosLabel.
-
getPositiveLabel
public long getPositiveLabel()
Gets the value of PosLabel
-
transform
public NumpyArray<Long> transform(List<Object> array)
Takes the input array and transforms it.- Specified by:
transformin classTransformerMixin<List<Object>,NumpyArray<Long>>- Parameters:
array- The array to transform.- Returns:
- The transformed array.
-
inverseTransform
public List<Object> inverseTransform(NumpyArray<Long> array)
Takes a transformed array and reveres the transformation.- Specified by:
inverseTransformin classTransformerMixin<List<Object>,NumpyArray<Long>>- Parameters:
array- The array to apply reveres transform.- Returns:
- The inversed transform of array.
-
-