Class RegressionMetrics

Object
org.apache.spark.mllib.evaluation.RegressionMetrics
All Implemented Interfaces:
org.apache.spark.internal.Logging

public class RegressionMetrics extends Object implements org.apache.spark.internal.Logging
Evaluator for regression.

param: predictionAndObservations an RDD of either (prediction, observation, weight) or (prediction, observation) pairs param: throughOrigin True if the regression is through the origin. For example, in linear regression, it will be true without fitting intercept.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging

    org.apache.spark.internal.Logging.SparkShellLoggingFilter
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations)
     
    RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the variance explained by regression.
    double
    Returns the mean absolute error, which is a risk function corresponding to the expected value of the absolute error loss or l1-norm loss.
    double
    Returns the mean squared error, which is a risk function corresponding to the expected value of the squared error loss or quadratic loss.
    double
    r2()
    Returns R^2^, the unadjusted coefficient of determination.
    double
    Returns the root mean squared error, which is defined as the square root of the mean squared error.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.spark.internal.Logging

    initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq
  • Constructor Details

    • RegressionMetrics

      public RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin)
    • RegressionMetrics

      public RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations)
  • Method Details

    • explainedVariance

      public double explainedVariance()
      Returns the variance explained by regression. explainedVariance = $\sum_i (\hat{y_i} - \bar{y})^2^ / n$
      Returns:
      (undocumented)
      See Also:
    • meanAbsoluteError

      public double meanAbsoluteError()
      Returns the mean absolute error, which is a risk function corresponding to the expected value of the absolute error loss or l1-norm loss.
      Returns:
      (undocumented)
    • meanSquaredError

      public double meanSquaredError()
      Returns the mean squared error, which is a risk function corresponding to the expected value of the squared error loss or quadratic loss.
      Returns:
      (undocumented)
    • r2

      public double r2()
      Returns R^2^, the unadjusted coefficient of determination.
      Returns:
      (undocumented)
      See Also:
    • rootMeanSquaredError

      public double rootMeanSquaredError()
      Returns the root mean squared error, which is defined as the square root of the mean squared error.
      Returns:
      (undocumented)