Package smile.validation
Class RegressionMetrics
java.lang.Object
smile.validation.RegressionMetrics
- All Implemented Interfaces:
Serializable
The regression validation metrics.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionfinal double
The time in milliseconds of fitting the model.final double
The mean absolute deviation on validation data.final double
The mean squared error on validation data.final double
The R-squared score on validation data.final double
The root mean squared error on validation data.final double
The residual sum of squares on validation data.final double
The time in milliseconds of scoring the validation data.final int
The validation data size. -
Constructor Summary
ConstructorDescriptionRegressionMetrics
(double fitTime, double scoreTime, int size, double rss, double mse, double rmse, double mad, double r2) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic RegressionMetrics
of
(double fitTime, double scoreTime, double[] truth, double[] prediction) Computes the regression metrics.static <M extends DataFrameRegression>
RegressionMetricsTrains and validates a model on a train/validation split.static <T,
M extends Regression<T>>
RegressionMetricsof
(double fitTime, M model, T[] testx, double[] testy) Validates a model on a test data.static <M extends DataFrameRegression>
RegressionMetricsTrains and validates a model on a train/validation split.static <T,
M extends Regression<T>>
RegressionMetricsof
(M model, T[] testx, double[] 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. -
rss
public final double rssThe residual sum of squares on validation data. -
mse
public final double mseThe mean squared error on validation data. -
rmse
public final double rmseThe root mean squared error on validation data. -
mad
public final double madThe mean absolute deviation on validation data. -
r2
public final double r2The R-squared score on validation data.
-
-
Constructor Details
-
RegressionMetrics
public RegressionMetrics(double fitTime, double scoreTime, int size, double rss, double mse, double rmse, double mad, double r2) 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.rss
- the residual sum of squares on validation data.mse
- the mean squared error on validation data.rmse
- the root mean squared error on validation data.mad
- the mean absolute deviation on validation data.r2
- the R-squared score on validation data.
-
-
Method Details
-
toString
-
of
public static RegressionMetrics of(double fitTime, double scoreTime, double[] truth, double[] prediction) Computes the regression 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 validation metrics.
-
of
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 responsible variable of validation data.- Returns:
- the validation metrics.
-
of
public static <T,M extends Regression<T>> RegressionMetrics of(double fitTime, M model, T[] testx, double[] 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 responsible variable of validation data.- Returns:
- the validation metrics.
-
of
public static <M extends DataFrameRegression> RegressionMetrics of(M model, Formula formula, DataFrame test) Trains and validates a model on a train/validation split.- Type Parameters:
M
- the model type.- Parameters:
model
- the model.formula
- the model formula.test
- the validation data.- Returns:
- the validation metrics.
-
of
public static <M extends DataFrameRegression> RegressionMetrics of(double fitTime, M model, Formula formula, DataFrame test) Trains and validates a model on a train/validation split.- 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 metrics.
-