Record Class ClassificationMetrics
java.lang.Object
java.lang.Record
smile.validation.ClassificationMetrics
- Record Components:
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.
- All Implemented Interfaces:
Serializable
public record 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)
extends Record
implements Serializable
The classification validation metrics.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionClassificationMetrics(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) Creates an instance of aClassificationMetricsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleaccuracy()Returns the value of theaccuracyrecord component.doubleauc()Returns the value of theaucrecord component.static ClassificationMetricsbinary(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the binary classification metrics.static ClassificationMetricsbinary(double fitTime, double scoreTime, int[] truth, int[] prediction, double[] probability) Computes the binary soft classification metrics.doubleReturns the value of thecrossEntropyrecord component.final booleanIndicates whether some other object is "equal to" this one.interror()Returns the value of theerrorrecord component.doublef1()Returns the value of thef1record component.doublefitTime()Returns the value of thefitTimerecord component.final inthashCode()Returns a hash code value for this object.doublelogloss()Returns the value of theloglossrecord component.doublemcc()Returns the value of themccrecord component.static ClassificationMetricsof(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the basic classification metrics.static ClassificationMetricsof(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.doubleReturns the value of theprecisionrecord component.doubleReturns the value of thescoreTimerecord component.doubleReturns the value of thesensitivityrecord component.intsize()Returns the value of thesizerecord component.doubleReturns the value of thespecificityrecord component.toString()Returns a string representation of this record class.
-
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) Creates an instance of aClassificationMetricsrecord class.- Parameters:
fitTime- the value for thefitTimerecord componentscoreTime- the value for thescoreTimerecord componentsize- the value for thesizerecord componenterror- the value for theerrorrecord componentaccuracy- the value for theaccuracyrecord componentsensitivity- the value for thesensitivityrecord componentspecificity- the value for thespecificityrecord componentprecision- the value for theprecisionrecord componentf1- the value for thef1record componentmcc- the value for themccrecord componentauc- the value for theaucrecord componentlogloss- the value for theloglossrecord componentcrossEntropy- the value for thecrossEntropyrecord component
-
-
Method Details
-
toString
-
of
public static ClassificationMetrics of(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the basic 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.
-
binary
public static ClassificationMetrics binary(double fitTime, double scoreTime, int[] truth, int[] prediction) Computes the binary 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.
-
binary
public static ClassificationMetrics binary(double fitTime, double scoreTime, int[] truth, int[] prediction, double[] probability) Computes the binary 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.probability- the probabilities of positive 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.
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
fitTime
-
scoreTime
-
size
-
error
-
accuracy
-
sensitivity
public double sensitivity()Returns the value of thesensitivityrecord component.- Returns:
- the value of the
sensitivityrecord component
-
specificity
public double specificity()Returns the value of thespecificityrecord component.- Returns:
- the value of the
specificityrecord component
-
precision
-
f1
-
mcc
-
auc
-
logloss
-
crossEntropy
public double crossEntropy()Returns the value of thecrossEntropyrecord component.- Returns:
- the value of the
crossEntropyrecord component
-