-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-5317]Set BoostingStrategy.defaultParams With Enumeration Algo.Classification or Algo.Regression #4103
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
Changes from 5 commits
a4aea51
68cf544
e04a5aa
65f96ce
d5c8a2e
7c1e6ee
3b72875
87bab1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,4 +88,25 @@ object BoostingStrategy { | |
| throw new IllegalArgumentException(s"$algo is not supported by boosting.") | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns default configuration for the boosting algorithm | ||
| * @param algo Learning goal. Supported: | ||
| * [[org.apache.spark.mllib.tree.configuration.Algo.Classification]], | ||
| * [[org.apache.spark.mllib.tree.configuration.Algo.Regression]] | ||
| * @return Configuration for boosting algorithm | ||
| */ | ||
| def defaultParams(algo: Algo): BoostingStrategy = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we update the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you mean that remove the defaultParams(algoStr: String) and with the defaultParams(algo: Algo) instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or change the defaultParams(algo: String) to defaultParams(algoStr: String)?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I thought the param name is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Please check the new commits. Thanks. |
||
| val treeStragtegy = Strategy.defaultStategy(algo) | ||
| treeStragtegy.maxDepth = 3 | ||
| algo match { | ||
| case Algo.Classification => | ||
| treeStragtegy.numClasses = 2 | ||
| new BoostingStrategy(treeStragtegy, LogLoss) | ||
| case Algo.Regression => | ||
| new BoostingStrategy(treeStragtegy, SquaredError) | ||
| case _ => | ||
| throw new IllegalArgumentException(s"$algo is not supported by boosting.") | ||
| } | ||
| } | ||
| } | ||
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.
This doesn't work in Java. You need at least "Algo.Classification()`.
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.
Seems that I am a little careless about the docs of Java version. I will update it.