Package smile.classification
Class ClassLabels
java.lang.Object
smile.classification.ClassLabels
- All Implemented Interfaces:
Serializable
Map arbitrary class labels to [0, k), where k is the number of classes.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLabels
fit
(int[] y) Fits the class label mapping.static ClassLabels
Fits the class label mapping.static ClassLabels
fit
(BaseVector<?, ?, ?> response) Fits the class label mapping.int[]
indexOf
(int[] y) Maps the class labels to index.scale()
Returns the nominal scale of the class labels.
-
Field Details
-
k
public final int kThe number of classes. -
classes
The class labels. -
y
public final int[] yThe sample class id in [0, k). -
ni
public final int[] niThe number of samples per classes. -
priori
public final double[] prioriThe estimated priori probabilities.
-
-
Constructor Details
-
ClassLabels
Constructor.- Parameters:
k
- The number of classes.y
- The sample class id in [0, k).classes
- the class label encoder.
-
-
Method Details
-
scale
Returns the nominal scale of the class labels.- Returns:
- the nominal scale of the class labels.
-
indexOf
public int[] indexOf(int[] y) Maps the class labels to index.- Parameters:
y
- the sample labels.- Returns:
- the indices of labels.
-
fit
Fits the class label mapping.- Parameters:
data
- the sample instances.- Returns:
- the class label mapping.
-
fit
Fits the class label mapping.- Parameters:
y
- the sample labels.- Returns:
- the class label mapping.
-
fit
Fits the class label mapping.- Parameters:
response
- the sample labels.- Returns:
- the class label mapping.
-