Class DataFrameClassifier.VectorDataFrameClassifier
java.lang.Object
smile.classification.DataFrameClassifier.VectorDataFrameClassifier
- All Implemented Interfaces:
Serializable, ToDoubleFunction<Tuple>, ToIntFunction<Tuple>, Classifier<Tuple>, DataFrameClassifier, SHAP<Tuple>
- Enclosing interface:
DataFrameClassifier
public static final class DataFrameClassifier.VectorDataFrameClassifier
extends Object
implements DataFrameClassifier, SHAP<Tuple>, Serializable
Adapter wrapping a vector
Classifier<double[]> as a DataFrameClassifier with SHAP<Tuple> support.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataFrameClassifier
DataFrameClassifier.EnsembleDataFrameClassifier, DataFrameClassifier.Trainer<M>, DataFrameClassifier.VectorDataFrameClassifier -
Method Summary
Modifier and TypeMethodDescriptionint[]classes()Returns the class labels.formula()Returns the formula associated with the model.booleanisOnline()Returns true if this is an online learner.booleanisSoft()Returns true if this is a soft classifier that can estimate the posteriori probabilities of classification.intReturns the number of classes.intPredicts the class label of an instance.intPredicts the class label of an instance and also calculate a posteriori probabilities.schema()Returns the predictor schema.double[]Returns the SHAP values.double[]shap(Tuple x, KernelSHAP.Options options) Returns the SHAP values with customKernelSHAP.Options(ignored by exact explainers such asTreeSHAPand linear SHAP).voidOnline update the classifier with a new training instance.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Classifier
applyAsDouble, applyAsInt, predict, predict, predict, predict, predict, predict, score, update, updateMethods inherited from interface DataFrameClassifier
predict, predict
-
Method Details
-
formula
Description copied from interface:DataFrameClassifierReturns the formula associated with the model.- Specified by:
formulain interfaceDataFrameClassifier- Returns:
- the formula associated with the model.
-
schema
Description copied from interface:DataFrameClassifierReturns the predictor schema.- Specified by:
schemain interfaceDataFrameClassifier- Returns:
- the predictor schema.
-
isSoft
public boolean isSoft()Description copied from interface:ClassifierReturns true if this is a soft classifier that can estimate the posteriori probabilities of classification.- Specified by:
isSoftin interfaceClassifier<Tuple>- Returns:
- true if soft classifier.
-
isOnline
public boolean isOnline()Description copied from interface:ClassifierReturns true if this is an online learner.- Specified by:
isOnlinein interfaceClassifier<Tuple>- Returns:
- true if online learner.
-
numClasses
public int numClasses()Description copied from interface:ClassifierReturns the number of classes.- Specified by:
numClassesin interfaceClassifier<Tuple>- Returns:
- the number of classes.
-
classes
public int[] classes()Description copied from interface:ClassifierReturns the class labels.- Specified by:
classesin interfaceClassifier<Tuple>- Returns:
- the class labels.
-
predict
Description copied from interface:ClassifierPredicts the class label of an instance.- Specified by:
predictin interfaceClassifier<Tuple>- Parameters:
x- the instance to be classified.- Returns:
- the predicted class label.
-
predict
Description copied from interface:ClassifierPredicts the class label of an instance and also calculate a posteriori probabilities. Classifiers may NOT support this method since not all classification algorithms are able to calculate such a posteriori probabilities.- Specified by:
predictin interfaceClassifier<Tuple>- Parameters:
x- an instance to be classified.posteriori- a posteriori probabilities on output.- Returns:
- the predicted class label
-
update
Description copied from interface:ClassifierOnline update the classifier with a new training instance. In general, this method may be NOT multi-thread safe.- Specified by:
updatein interfaceClassifier<Tuple>- Parameters:
x- the training instance.y- the training label.
-
shap
Description copied from interface:SHAPReturns the SHAP values. For regression, the length of SHAP values is same as the number of features. For classification, SHAP values are ofp x k, wherepis the number of features andkis the classes. The first k elements are the SHAP values of first feature over k classes, respectively. The rest features follow accordingly. -
shap
Description copied from interface:SHAPReturns the SHAP values with customKernelSHAP.Options(ignored by exact explainers such asTreeSHAPand linear SHAP).
-