Class RegressionMetrics
Object
org.apache.spark.mllib.evaluation.RegressionMetrics
- All Implemented Interfaces:
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.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
-
Constructor Summary
ConstructorDescriptionRegressionMetrics
(RDD<? extends scala.Product> predictionAndObservations) RegressionMetrics
(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin) -
Method Summary
Modifier and TypeMethodDescriptiondouble
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, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContext
-
Constructor Details
-
RegressionMetrics
public RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin) -
RegressionMetrics
-
-
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:
-
- Coefficient of determination (Wikipedia) In case of regression through the origin, the definition of R^2^ is to be modified.
- J. G. Eisenhauer, Regression through the Origin. Teaching Statistics 25, 76-80 (2003)
-
rootMeanSquaredError
public double rootMeanSquaredError()Returns the root mean squared error, which is defined as the square root of the mean squared error.- Returns:
- (undocumented)
-