Skip to content

Commit

Permalink
Fix python unit test and add document.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Jun 20, 2015
1 parent d632135 commit 930d3db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ final class RegressionEvaluator(override val uid: String)

/**
* param for metric name in evaluation (supports `"rmse"` (default), `"mse"`, `"r2"`, and `"mae"`)
*
* Because we will maximize evaluation value (ref: `CrossValidator`),
* when we evaluate a metric that is needed to minimize (e.g., `"rmse"`, `"mse"`, `"mae"`),
* we take and output the negative of this metric.
* @group param
*/
val metricName: Param[String] = {
Expand Down
8 changes: 5 additions & 3 deletions python/pyspark/ml/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@ class RegressionEvaluator(JavaEvaluator, HasLabelCol, HasPredictionCol):
...
>>> evaluator = RegressionEvaluator(predictionCol="raw")
>>> evaluator.evaluate(dataset)
2.842...
-2.842...
>>> evaluator.evaluate(dataset, {evaluator.metricName: "r2"})
0.993...
>>> evaluator.evaluate(dataset, {evaluator.metricName: "mae"})
2.649...
-2.649...
"""
# a placeholder to make it appear in the generated doc
# Because we will maximize evaluation value (ref: `CrossValidator`),
# when we evaluate a metric that is needed to minimize (e.g., `"rmse"`, `"mse"`, `"mae"`),
# we take and output the negative of this metric.
metricName = Param(Params._dummy(), "metricName",
"metric name in evaluation (mse|rmse|r2|mae)")

Expand Down

0 comments on commit 930d3db

Please sign in to comment.