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 SummaryNested classes/interfaces inherited from interface org.apache.spark.internal.Loggingorg.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
- 
Constructor SummaryConstructorsConstructorDescriptionRegressionMetrics(RDD<? extends scala.Product> predictionAndObservations) RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin) 
- 
Method SummaryModifier and TypeMethodDescriptiondoubleReturns the variance explained by regression.doubleReturns the mean absolute error, which is a risk function corresponding to the expected value of the absolute error loss or l1-norm loss.doubleReturns the mean squared error, which is a risk function corresponding to the expected value of the squared error loss or quadratic loss.doubler2()Returns R^2^, the unadjusted coefficient of determination.doubleReturns the root mean squared error, which is defined as the square root of the mean squared error.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.internal.LogginginitializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logBasedOnLevel, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, MDC, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContext
- 
Constructor Details- 
RegressionMetricspublic RegressionMetrics(RDD<? extends scala.Product> predictionAndObservations, boolean throughOrigin) 
- 
RegressionMetrics
 
- 
- 
Method Details- 
explainedVariancepublic double explainedVariance()Returns the variance explained by regression. explainedVariance = $\sum_i (\hat{y_i} - \bar{y})^2^ / n$- Returns:
- (undocumented)
- See Also:
 
- 
meanAbsoluteErrorpublic 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)
 
- 
meanSquaredErrorpublic 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)
 
- 
r2public 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)
 
 
- 
rootMeanSquaredErrorpublic double rootMeanSquaredError()Returns the root mean squared error, which is defined as the square root of the mean squared error.- Returns:
- (undocumented)
 
 
-