-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-1994] [ml] Add different gain calculation schemes to SGD #1397
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
Conversation
|
There are still some scalastyle violations You can check that locally by simply running |
|
That last fail looked like it happened in Kafka from something I never touched? E.g. random. Is there anyway to just retry the travis-ci build? |
|
The Kafka tests are not written in a bullet proof way. It may happen that the Kafka test-cluster has a hickup, in which case the tests cannot succeed... You can (force) push changes to your branch, that re-triggers the CI. |
|
So... looks like this passed. What do I do next? |
flink-staging/flink-ml/pom.xml
Outdated
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 don't change indent.
|
I think I really screwed this up... I was just trying to undo the changes to flink-staging/flink-ml/pom.xml |
|
Hi @rawkintrevo, I think you should rebase your branch instead of merging master branch. Could you update your branch? Note that you should force push ( |
0a6b52f to
eafe068
Compare
|
So do I need to do anything else for this to get merged? |
|
Hi @rawkintrevo, I'm sorry about waiting you. I have looked your pull request. Almost of changes are good but I have some few comments. First, there are some meaningless changes such as indentation in Second, how about using Third, I think that we should apply this changes to documentation. Please add this content into the FlinkML documentation. :) |
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.
Indentation:
override def optimize(
data: ...
initialWeights: ...)
: DataSet[WeightVector] = {
}
|
on your second point- I agree that Enum would be better for human readable variable setting, but if one was doing a grid parameter search it would be easier to search over a range of integers than having to establish an array of specifically named variables. Not significantly harder, but still slightly more tedious. Further, since I'm just learning scala- limited research/understanding leads me to believe 1) scala doesn't have an enum that works just like Java, and 2) changing the cases to more informative string names would achieve the desired goal? In the mean time working on documentation and reverting the indentation (which I thought I had already done), and thanks for bearing with me as I am still learning. |
|
Hi @rawkintrevo, you can convert scala Enum to Int like following: object Parameter extends Enumeration {
type Parameter = Value
val Param1, Param2, Param3, Param4 = Value
}
val convertedInt: Int = Parameter.Param1.idAlso, these values can be caught by pattern matching: import Parameter._
val param: Parameter = getSomeEnumValues()
param match {
case Param1 => // blahblah
case Param2 => // blahblah
case Param3 => // blahblah
case Param4 => // blahblah
} |
|
still refactoring to enumeration, but wanted to toss this up in case anyone is watching- I added a decay parameter which significantly generalizes the Xu and Inverse Scaling Methods. Also I added some docs, but am open to suggestions, for example- once I figure out how to set the method with enumeration, I'll include a note? UPDATE: The more I think about this, I feel like any implementation I can think of adds a lot of complexity for very little marginal gain. That said I don't understand the advantage of enumeration over passing strings as the main benefit is it being better for humans reading the code. If the benefits are significant can that be an improvement on another ticket? Any solution I come up with I feel is going to be awkward and I fear will be a candidate for refactoring anyway. I think my energy is better spent developing tests for this at the moment. |
1cd4b14 to
14fe0ff
Compare
|
I still would like to use enumeration because if we use string parameters, the user cannot check that the input parameter is valid. But if you have some problems to use enumeration, I'll modify your pull request before merging it. Failing CI seems unrelated this PR. I'll check and test this. |
|
I can't get the enumeration thing to work. If you can modify it that would be awesome. Thanks. |
docs/libs/ml/optimization.md
Outdated
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.
Where is decay explained?
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.
In which formula is k actually used?
|
I had some minor comments. I also opened a PR against your branch @rawkintrevo which shows how one could solve the problem with the enumerations (rawkintrevo#1). Would be great if we can fix these last issues :-) |
|
For sure, definitely want to close the books on this one, and I appreciate all your help and patience as I have been learning. I will work on this tonight. |
|
👍 |
Added SGD gain calculation schemes fixed optimal SGD calculation scheme FLINK-1994: Added 4 new effective learning rates [FLINK-1994] [ml] Add different gain calculation schemes to SGD fixed long lines in GradientDescent.scala [FLINK-1994][ml]Add different gain calculation schemes to SGD [FLINK-1994][ml] Add different gain calculation schemes to SGD [FLINK-1994][ml] Add different gain calculation schemes to SGD Added SGD gain calculation schemes fixed optimal SGD calculation scheme [FLINK-1994] [ml] Add different gain calculation schemes to SGD FLINK-1994: Added 3 new effective learning rates Added SGD gain calculation schemes fixed optimal SGD calculation scheme [FLINK-1994] [ml] Add different gain calculation schemes to SGD fixed long lines in GradientDescent.scala [FLINK-1994][ml] Add different gain calculation schemes to SGD [Flink-1994][ml] Add different gain calculation schemes to SGD [FLINK-1994][ml] Updated docs, refactored optimizationMethod from Int to String [FLINK-1994][ml] Added test and example to docs [FLINK-1994][ml] Fixed Int Artifacts in LinearRegression.scala Added LearningRateMethod to IterativeSolver The learning rate method defines how the effective learning step is calculated for each iteration step of the IterativeSolver. Fixed docs, merged enumeration from Till, fixed typo in Wus method
7a781aa to
94362a2
Compare
|
Sorry for the multiple commits- It wasn't registering the changes here so I kept pushing... I can squash them if you want. I update the docs per your comments, added a brief description of the meaning of the decay rate and noticed a typo in Wu's method (forgot a negative sign in the exponent). |
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 line should be changed to .setOptimizationMethod(LearningRateMethod.Xu).
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.
It should actually be .setLearningRateMethod(LearningRateMethod.Xu).
|
@rawkintrevo Thanks for update! I still prefer using a learning method instance as parameter to remove method-specific parameter such as Looks good to merge. 👍 |
|
Not squashing the commits here is the right way to go. We'll squash them once we merge it. |
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 should be renamed to LearningRateMethod
|
LGTM, will merge it then. I'll address @chiwanpark comment concerning the |
|
@tillrohrmann Thanks! It is good news. |
|
Thank you guys! |
Added SGD gain calculation schemes fixed optimal SGD calculation scheme FLINK-1994: Added 4 new effective learning rates [FLINK-1994] [ml] Add different gain calculation schemes to SGD fixed long lines in GradientDescent.scala [FLINK-1994][ml]Add different gain calculation schemes to SGD [FLINK-1994][ml] Add different gain calculation schemes to SGD [FLINK-1994][ml] Add different gain calculation schemes to SGD Added SGD gain calculation schemes fixed optimal SGD calculation scheme [FLINK-1994] [ml] Add different gain calculation schemes to SGD FLINK-1994: Added 3 new effective learning rates Added SGD gain calculation schemes fixed optimal SGD calculation scheme [FLINK-1994] [ml] Add different gain calculation schemes to SGD fixed long lines in GradientDescent.scala [FLINK-1994][ml] Add different gain calculation schemes to SGD [Flink-1994][ml] Add different gain calculation schemes to SGD [FLINK-1994][ml] Updated docs, refactored optimizationMethod from Int to String [FLINK-1994][ml] Added test and example to docs [FLINK-1994][ml] Fixed Int Artifacts in LinearRegression.scala Added LearningRateMethod to IterativeSolver The learning rate method defines how the effective learning step is calculated for each iteration step of the IterativeSolver. Fixed docs, merged enumeration from Till, fixed typo in Wus method [FLINK-1994][ml] Added 4 new effective learning rate methods [FLINK-1994][ml] Add different gain calulation schemes to SGD This closes apache#1397.
Continuation of pull request 1384.
Fixed long line issue, rebased on top of current master, and changed title per instructions.
#1384