Package smile.validation
Class ClassificationMetrics
java.lang.Object
smile.validation.ClassificationMetrics
- All Implemented Interfaces:
Serializable
The classification validation metrics.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionfinal double
The accuracy on validation data.final double
The AUC on validation data.final double
The cross entropy on validation data.final int
The number of errors.final double
The F-1 score on validation data.final double
The time in milliseconds of fitting the model.final double
The log loss on validation data.final double
The Matthews correlation coefficient on validation data.final double
The precision on validation data.final double
The time in milliseconds of scoring the validation data.final double
The sensitivity on validation data.final int
The validation data size.final double
The specificity on validation data. -
Constructor Summary
ConstructorDescriptionClassificationMetrics
(double fitTime, double scoreTime, int size, int error, double accuracy) Constructor.ClassificationMetrics
(double fitTime, double scoreTime, int size, int error, double accuracy, double crossentropy) Constructor of multiclass soft classifier validation.ClassificationMetrics
(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc) Constructor of binary classifier validation.ClassificationMetrics
(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc, double auc, double logloss) Constructor of binary soft classifier validation.ClassificationMetrics
(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc, double auc, double logloss, double crossentropy) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassificationMetrics
of
(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the classification metrics.static ClassificationMetrics
of
(double fitTime, double scoreTime, int[] truth, int[] prediction, double[][] posteriori) Computes the soft classification metrics.static <M extends DataFrameClassifier>
ClassificationMetricsValidates a model on a test data.static <T,
M extends Classifier<T>>
ClassificationMetricsof
(double fitTime, M model, T[] testx, int[] testy) Validates a model on a test data.static <M extends DataFrameClassifier>
ClassificationMetricsValidates a model on a test data.static <T,
M extends Classifier<T>>
ClassificationMetricsof
(M model, T[] testx, int[] testy) Validates a model on a test data.toString()
-
Field Details
-
fitTime
public final double fitTimeThe time in milliseconds of fitting the model. -
scoreTime
public final double scoreTimeThe time in milliseconds of scoring the validation data. -
size
public final int sizeThe validation data size. -
error
public final int errorThe number of errors. -
accuracy
public final double accuracyThe accuracy on validation data. -
sensitivity
public final double sensitivityThe sensitivity on validation data. -
specificity
public final double specificityThe specificity on validation data. -
precision
public final double precisionThe precision on validation data. -
f1
public final double f1The F-1 score on validation data. -
mcc
public final double mccThe Matthews correlation coefficient on validation data. -
auc
public final double aucThe AUC on validation data. -
logloss
public final double loglossThe log loss on validation data. -
crossentropy
public final double crossentropyThe cross entropy on validation data.
-
-
Constructor Details
-
ClassificationMetrics
public ClassificationMetrics(double fitTime, double scoreTime, int size, int error, double accuracy) Constructor.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.size
- the validation data size.error
- the number of errors.accuracy
- the accuracy on validation data.
-
ClassificationMetrics
public ClassificationMetrics(double fitTime, double scoreTime, int size, int error, double accuracy, double crossentropy) Constructor of multiclass soft classifier validation.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.size
- the validation data size.error
- the number of errors.accuracy
- the accuracy on validation data.crossentropy
- the cross entropy on validation data.
-
ClassificationMetrics
public ClassificationMetrics(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc) Constructor of binary classifier validation.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.size
- the validation data size.error
- the number of errors.accuracy
- the accuracy on validation data.sensitivity
- the sensitivity on validation data.specificity
- the specificity on validation data.precision
- the precision on validation data.f1
- the F-1 score on validation data.mcc
- the Matthews correlation coefficient on validation data.
-
ClassificationMetrics
public ClassificationMetrics(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc, double auc, double logloss) Constructor of binary soft classifier validation.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.size
- the validation data size.error
- the number of errors.accuracy
- the accuracy on validation data.sensitivity
- the sensitivity on validation data.specificity
- the specificity on validation data.precision
- the precision on validation data.f1
- the F-1 score on validation data.mcc
- the Matthews correlation coefficient on validation data.auc
- the AUC on validation data.logloss
- the log loss on validation data.
-
ClassificationMetrics
public ClassificationMetrics(double fitTime, double scoreTime, int size, int error, double accuracy, double sensitivity, double specificity, double precision, double f1, double mcc, double auc, double logloss, double crossentropy) Constructor.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.size
- the validation data size.error
- the number of errors.accuracy
- the accuracy on validation data.sensitivity
- the sensitivity on validation data.specificity
- the specificity on validation data.precision
- the precision on validation data.f1
- the F-1 score on validation data.mcc
- the Matthews correlation coefficient on validation data.auc
- the AUC on validation data.logloss
- the log loss on validation data.crossentropy
- the cross entropy on validation data.
-
-
Method Details
-
toString
-
of
public static ClassificationMetrics of(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the classification metrics.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.truth
- the ground truth.prediction
- the predictions.- Returns:
- the classification metrics.
-
of
public static ClassificationMetrics of(double fitTime, double scoreTime, int[] truth, int[] prediction, double[][] posteriori) Computes the soft classification metrics.- Parameters:
fitTime
- the time in milliseconds of fitting the model.scoreTime
- the time in milliseconds of scoring the validation data.truth
- the ground truth.prediction
- the predictions.posteriori
- the posteriori probabilities of predictions.- Returns:
- the classification metrics.
-
of
public static <T,M extends Classifier<T>> ClassificationMetrics of(M model, T[] testx, int[] testy) Validates a model on a test data.- Type Parameters:
T
- the data type of samples.M
- the model type.- Parameters:
model
- the model.testx
- the validation data.testy
- the class labels of validation data.- Returns:
- the validation results.
-
of
public static <T,M extends Classifier<T>> ClassificationMetrics of(double fitTime, M model, T[] testx, int[] testy) Validates a model on a test data.- Type Parameters:
T
- the data type of samples.M
- the model type.- Parameters:
fitTime
- the time in milliseconds of fitting the model.model
- the model.testx
- the validation data.testy
- the class labels of validation data.- Returns:
- the validation results.
-
of
public static <M extends DataFrameClassifier> ClassificationMetrics of(M model, Formula formula, DataFrame test) Validates a model on a test data.- Type Parameters:
M
- the model type.- Parameters:
model
- the model.formula
- the model formula.test
- the validation data.- Returns:
- the validation results.
-
of
public static <M extends DataFrameClassifier> ClassificationMetrics of(double fitTime, M model, Formula formula, DataFrame test) Validates a model on a test data.- Type Parameters:
M
- the model type.- Parameters:
fitTime
- the time in milliseconds of fitting the model.model
- the model.formula
- the model formula.test
- the validation data.- Returns:
- the validation results.
-