-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forecast evaluator + SMAPE metric #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
==========================================
- Coverage 86.65% 86.63% -0.02%
==========================================
Files 334 335 +1
Lines 10752 10763 +11
Branches 565 344 -221
==========================================
+ Hits 9317 9325 +8
- Misses 1435 1438 +3
Continue to review full report at Codecov.
|
core/src/main/scala/com/salesforce/op/evaluators/EvaluationMetrics.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/com/salesforce/op/evaluators/EvaluationMetrics.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/com/salesforce/op/evaluators/EvaluationMetrics.scala
Show resolved
Hide resolved
|
||
/** | ||
* | ||
* Instance to evaluate Regression metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs are incorrect
core/src/main/scala/com/salesforce/op/evaluators/OpForecastEvaluator.scala
Outdated
Show resolved
Hide resolved
|
||
val smape: Double = getSMAPE(dataUse, getLabelCol, getPredictionValueCol) | ||
val metrics = ForecastMetrics( | ||
sMAPE = smape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reformat into one liner
} | ||
|
||
// https://www.m4.unic.ac.cy/wp-content/uploads/2018/03/M4-Competitors-Guide.pdf | ||
case class ReduceSMAPE(nominator: Double, denominator: Double, cnt: Long) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of defining +
you can use algebird macro for case classes, i.e.
import com.twitter.algebird.Operators._
import com.twitter.algebird.macros.caseclass
implicit val smapeSG = caseclass.semigroup[SMAPEValue]
case class SMAPEValue(nominator: Double, denominator: Double, cnt: Long)
} | ||
|
||
object ReduceSMAPE { | ||
def apply(y: Double, y_hat: Double): ReduceSMAPE = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please make this the only public ctor
- avoid
_
in names, instead use camelCase
} | ||
|
||
/** | ||
* Metrics of Regression Problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks for the contribution! Before we can merge this, we need @wsuchy to sign the Salesforce.com Contributor License Agreement. |
This is only a POC, as I would like to check if it gets (eventually) merged.
So far I've implemented only one metric (sMAPE) but ideally I would like to put all forecast related metrics there (including some already present like MAE, etc).
As we don't have any forecasting model yet I've used linear regression.