spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davies <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4306] [MLlib] Python API for LogisticRe...
Date Mon, 17 Nov 2014 08:15:08 GMT
GitHub user davies opened a pull request:

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

    [SPARK-4306] [MLlib] Python API for LogisticRegressionWithLBFGS

    ```
    class LogisticRegressionWithLBFGS
     |  train(cls, data, iterations=100, initialWeights=None, corrections=10, tolerance=0.0001,
regParam=0.01, intercept=False)
     |      Train a logistic regression model on the given data.
     |
     |      :param data:           The training data, an RDD of LabeledPoint.
     |      :param iterations:     The number of iterations (default: 100).
     |      :param initialWeights: The initial weights (default: None).
     |      :param corrections:    The number of corrections used in the LBFGS update (default:
10).
     |      :param tolerance:      The convergence tolerance of iterations for L-BFGS (default:
1e-4).
     |      :param regParam:       The regularizer parameter (default: 0.01).
     |      :param intercept:      Boolean parameter which indicates the use
     |                             or not of the augmented representation for
     |                             training data (i.e. whether bias features
     |                             are activated or not).
     |
     |      >>> data = [
     |      ...     LabeledPoint(0.0, [0.0, 1.0]),
     |      ...     LabeledPoint(1.0, [1.0, 0.0]),
     |      ... ]
     |      >>> lrm = LogisticRegressionWithLBFGS.train(sc.parallelize(data))
     |      >>> lrm.predict([1.0, 0.0])
     |      1
     |      >>> lrm.predict([0.0, 1.0])
     |      0
     |      >>> lrm.predict(sc.parallelize([[1.0, 0.0], [0.0, 1.0]])).collect()
     |      [1, 0]
    ```
    
    This PR includes #3305, will rebase after that one merged.

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

    $ git pull https://github.com/davies/spark lbfgs

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

    https://github.com/apache/spark/pull/3307.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 #3307
    
----
commit c1e5573c8d3645a4471c62bfb45f384e91c0eb2b
Author: Davies Liu <davies@databricks.com>
Date:   2014-11-17T07:35:53Z

    improve classification

commit 2c3c1b4d10b783912d508cafd3700b61ef6a307b
Author: Davies Liu <davies@databricks.com>
Date:   2014-11-17T08:00:54Z

    python api for LogisticRegressionWithLBFGS

commit aee75f7f5353cfa4a90b20c67928097d5a5299e2
Author: Davies Liu <davies@databricks.com>
Date:   2014-11-17T08:11:45Z

    fix docs

----


---
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


Mime
View raw message