-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[SPARK-10592] [ML] [PySpark] Deprecate weights and use coefficients instead in ML models #9311
Conversation
Test build #44470 has finished for PR 9311 at commit
|
You can trace all |
Thanks! It seems like I missed some. I will trace and keep on deprecation. |
test this please |
Test build #44608 has finished for PR 9311 at commit
|
804c650
to
5cfa573
Compare
@@ -87,8 +87,8 @@ private[regression] trait IsotonicRegressionBase extends Params with HasFeatures | |||
lit(1.0) | |||
} | |||
dataset.select(col($(labelCol)), f, w) | |||
.map { case Row(label: Double, feature: Double, weights: Double) => | |||
(label, feature, weights) | |||
.map { case Row(label: Double, feature: Double, weight: Double) => |
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 is better to use weight
rather than weights
in there.
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.
Thanks for catching this!
didn't deprecate |
Test build #44675 has finished for PR 9311 at commit
|
5cfa573
to
f1050ae
Compare
Test build #44680 has finished for PR 9311 at commit
|
@@ -51,13 +51,22 @@ private[r] object SparkRWrappers { | |||
pipeline.fit(df) | |||
} | |||
|
|||
@deprecated("Use getModelCoefficients instead.", "1.6.0") |
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.
We don't need to put the deprecation message because this is a private object. Just renaming the method should be sufficient.
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.
Since it's private, why don't we remove it entirely?
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 except one minor issue. @dbtsai Do you have time to make another pass? |
val intercept: Double) | ||
extends ProbabilisticClassificationModel[Vector, LogisticRegressionModel] | ||
with LogisticRegressionParams { | ||
|
||
@deprecated("Use coefficients instead.", "1.6.0") | ||
def weights: Vector = coefficients |
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.
Will this cause binary compatibility issue?
This looks good to me, but I wonder if changing from |
No, that is a compatible change. |
Thanks. Merged into master. |
@dbtsai The comment on |
@bharath-official Try to use coefficients instead. This is warning information. Did you get error message? I think it will be fine cause we didn't remove weights. |
@vectorijk Yes you are right Kai it is a warning that is thrown and not an error. The function also seems to work as expected. Since this use case gets showcased in one of our user documentation, I wanted to keep it clean by eliminating the warnings too. When you say use coefficients instead, Sorry I didnt get the context. My understanding was that, the transform function that I am calling on model in turn uses weights and thus this cant be fixed from the callers side. This needs to be fixed in the source code of transform function. Correct me if I am wrong. |
@bharath-official You're right. |
@vectorijk Yes you are right. It works fine but throws a warning which I am trying to avoid. Would it make sense if I go ahead and look at the transform code in Spark and change weights to coefficients and send you a PR? |
@bharath-official I don't think it's really necessary because it was changed in Spark 2.0 |
@vectorijk Oh great then! That makes sense. Thanks for your inputs Kai. |
Deprecated in
LogisticRegression
andLinearRegression