Class RegressionMetrics

java.lang.Object
smile.validation.RegressionMetrics
All Implemented Interfaces:
Serializable

public class RegressionMetrics extends Object implements Serializable
The regression validation metrics.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final 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

    Constructors
    Constructor
    Description
    RegressionMetrics(double fitTime, double scoreTime, int size, double rss, double mse, double rmse, double mad, double r2)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    of(double fitTime, double scoreTime, double[] truth, double[] prediction)
    Computes the regression metrics.
    of(double fitTime, M model, Formula formula, DataFrame test)
    Trains and validates a model on a train/validation split.
    static <T, M extends Regression<T>>
    RegressionMetrics
    of(double fitTime, M model, T[] testx, double[] testy)
    Validates a model on a test data.
    of(M model, Formula formula, DataFrame test)
    Trains and validates a model on a train/validation split.
    static <T, M extends Regression<T>>
    RegressionMetrics
    of(M model, T[] testx, double[] testy)
    Validates a model on a test data.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • fitTime

      public final double fitTime
      The time in milliseconds of fitting the model.
    • scoreTime

      public final double scoreTime
      The time in milliseconds of scoring the validation data.
    • size

      public final int size
      The validation data size.
    • rss

      public final double rss
      The residual sum of squares on validation data.
    • mse

      public final double mse
      The mean squared error on validation data.
    • rmse

      public final double rmse
      The root mean squared error on validation data.
    • mad

      public final double mad
      The mean absolute deviation on validation data.
    • r2

      public final double r2
      The 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

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public static <T, M extends Regression<T>> RegressionMetrics of(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:
      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.