You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by daniel-acuna <gi...@git.apache.org> on 2014/11/17 21:15:43 UTC

[GitHub] spark pull request: Logistic regression gradient fixed

GitHub user daniel-acuna opened a pull request:

    https://github.com/apache/spark/pull/3325

    Logistic regression gradient fixed

    The gradient of the logistic regression was not accurate. Please see last equation on page 18 from Andrew Ng's lecture notes (http://cs229.stanford.edu/notes/cs229-notes1.pdf)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/daniel-acuna/spark master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/3325.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3325
    
----
commit 89aa9789e822aee96bf8934797ae7f3f01625ce3
Author: Daniel Acuna <da...@northwestern.edu>
Date:   2014-11-17T20:12:32Z

    Logistic regression gradient fixed

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/3325#issuecomment-64297272
  
    @daniel-acuna The example code is not tagged MLlib. For people who is familiar with logistic regression gradient and new to Spark, that's is more common. In MLlib, we mentioned this in both the API doc and the user guide: 
    
    https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.mllib.classification.LogisticRegressionWithSGD
    
    https://spark.apache.org/docs/latest/mllib-data-types.html#labeled-point
    
    Since this is not an issue, do you mind closing this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/3325#issuecomment-63368360
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by daniel-acuna <gi...@git.apache.org>.
Github user daniel-acuna commented on the pull request:

    https://github.com/apache/spark/pull/3325#issuecomment-63518319
  
    Oh I see. Thanks for the detailed explanation. 
    
    So adding a comment about Y being either -1 or 1 would help. Also, as the other commenter said, I would like to add a comment in the documentation file https://spark.apache.org/examples.html, but I failed to find that file in this depository.
    
    Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by daniel-acuna <gi...@git.apache.org>.
Github user daniel-acuna closed the pull request at:

    https://github.com/apache/spark/pull/3325


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by titipata <gi...@git.apache.org>.
Github user titipata commented on the pull request:

    https://github.com/apache/spark/pull/3325#issuecomment-63370068
  
    If it is correct, we should fix equation in Spark example page also (https://spark.apache.org/examples.html)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: Logistic regression gradient fixed

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/3325#issuecomment-63398036
  
    This is actually an alternate form of the same gradient, but, it works when y is -1/+1, not when y is 0/1. It comes from the loss function `log(1 + exp(-y * x.dot(w))`. Here's a decent writeup: http://work.caltech.edu/library/093.pdf 
    
    You can work out it's the same thing, plugging in the two possible values of y in each case. Note there's an extra sign flip since this is a loss you minimize, wherein in the lecture notes you refer to, it's maximizing a log-likelihood. 
    
    The "real" implementation in Spark uses a gradient more like what you propose, and I find it a bit simpler myself.
    
    If this changes, you'd have to make sure the input is not assumed to be -1/+1 anywhere since it wouldn't work then. I'm not sure how much that's depended-on in this example.
    
    At the least, you could add clarifying comments about the input label requirement!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org