Package ai.sklearn4j.base
Class ClassifierMixin
- java.lang.Object
-
- ai.sklearn4j.base.ClassifierMixin
-
- Direct Known Subclasses:
BaseNaiveBayes
public abstract class ClassifierMixin extends Object
Mixin class for all classifiers in scikit-learn.
-
-
Field Summary
Fields Modifier and Type Field Description protected NumpyArray<Double>classCountsThe frequency of each class in the training set.protected NumpyArray<Long>classesThe list of class IDs.
-
Constructor Summary
Constructors Constructor Description ClassifierMixin()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description NumpyArray<Double>getClassCounts()Gets the class counts.NumpyArray<Long>getClasses()Gets the classes.String[]getFeatureNamesIn()Gets the feature names.intgetNumberOfFeatures()Gets the number of features.abstract NumpyArray<Long>predict(NumpyArray<Double> x)Perform classification on an array of test vectors X.abstract NumpyArray<Double>predictLogProbabilities(NumpyArray<Double> x)Return log-probability estimates for the test vector X.abstract NumpyArray<Double>predictProbabilities(NumpyArray<Double> x)Return probability estimates for the test vector X.voidsetClassCounts(NumpyArray<Double> classCounts)Sets the class counts.voidsetClasses(NumpyArray<Long> classes)Sets the classes.voidsetFeatureNamesIn(String[] featureNamesIn)Sets the feature names.voidsetNumberOfFeatures(int numberOfFeatures)Sets the number of features.
-
-
-
Field Detail
-
classCounts
protected NumpyArray<Double> classCounts
The frequency of each class in the training set. Dimension: (class_count)
-
classes
protected NumpyArray<Long> classes
The list of class IDs. Dimension: (class_count)
-
-
Method Detail
-
predict
public abstract NumpyArray<Long> predict(NumpyArray<Double> x)
Perform classification on an array of test vectors X.- Parameters:
x- Array-like of shape (n_samples, n_features) The input samples.- Returns:
- NumpyArray of shape (n_samples,) Predicted target values for X.
-
predictLogProbabilities
public abstract NumpyArray<Double> predictLogProbabilities(NumpyArray<Double> x)
Return log-probability estimates for the test vector X.- Parameters:
x- array-like of shape (n_samples, n_features) The input samples.- Returns:
- array-like of shape (n_samples, n_classes) Returns the log-probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute :term:`classes_`.
-
predictProbabilities
public abstract NumpyArray<Double> predictProbabilities(NumpyArray<Double> x)
Return probability estimates for the test vector X.- Parameters:
x- array-like of shape (n_samples, n_features) The input samples.- Returns:
- array-like of shape (n_samples, n_classes) Returns the probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute :term:`classes_`.
-
getFeatureNamesIn
public String[] getFeatureNamesIn()
Gets the feature names.- Returns:
- The value of feature names.
-
setFeatureNamesIn
public void setFeatureNamesIn(String[] featureNamesIn)
Sets the feature names.- Parameters:
featureNamesIn- New value to be stored.
-
getNumberOfFeatures
public int getNumberOfFeatures()
Gets the number of features.- Returns:
- The value of number of features.
-
setNumberOfFeatures
public void setNumberOfFeatures(int numberOfFeatures)
Sets the number of features.- Parameters:
numberOfFeatures- New value to be stored.
-
getClassCounts
public NumpyArray<Double> getClassCounts()
Gets the class counts.- Returns:
- The value of class counts.
-
setClassCounts
public void setClassCounts(NumpyArray<Double> classCounts)
Sets the class counts.- Parameters:
classCounts- New value to be stored.
-
getClasses
public NumpyArray<Long> getClasses()
Gets the classes.- Returns:
- The value of classes.
-
setClasses
public void setClasses(NumpyArray<Long> classes)
Sets the classes.- Parameters:
classes- New value to be stored.
-
-