[ 
https://issues.apache.org/jira/browse/SPARK-7474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xiangrui Meng resolved SPARK-7474.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.4.0

Issue resolved by pull request 6001
[https://github.com/apache/spark/pull/6001]

> ParamGridBuilder's doctest doesn't show up correctly in the generated doc
> -------------------------------------------------------------------------
>
>                 Key: SPARK-7474
>                 URL: https://issues.apache.org/jira/browse/SPARK-7474
>             Project: Spark
>          Issue Type: Documentation
>          Components: Documentation, ML
>    Affects Versions: 1.4.0
>            Reporter: Xiangrui Meng
>            Assignee: Xiangrui Meng
>             Fix For: 1.4.0
>
>
> {code}
> >>> from classification import LogisticRegression
> >>> lr = LogisticRegression()
> >>> output = ParamGridBuilder().baseOn({lr.labelCol: 'l'})             
> >>> .baseOn([lr.predictionCol, 'p'])             .addGrid(lr.regParam, [1.0, 
> >>> 2.0, 3.0])             .addGrid(lr.maxIter, [1, 5])             
> >>> .addGrid(lr.featuresCol, ['f'])             .build()
> >>> expected = [ {lr.regParam: 1.0, lr.featuresCol: 'f', lr.maxIter: 1, 
> >>> lr.labelCol: 'l', lr.predictionCol: 'p'}, {lr.regParam: 2.0, 
> >>> lr.featuresCol: 'f', lr.maxIter: 1, lr.labelCol: 'l', lr.predictionCol: 
> >>> 'p'}, {lr.regParam: 3.0, lr.featuresCol: 'f', lr.maxIter: 1, lr.labelCol: 
> >>> 'l', lr.predictionCol: 'p'}, {lr.regParam: 1.0, lr.featuresCol: 'f', 
> >>> lr.maxIter: 5, lr.labelCol: 'l', lr.predictionCol: 'p'}, {lr.regParam: 
> >>> 2.0, lr.featuresCol: 'f', lr.maxIter: 5, lr.labelCol: 'l', 
> >>> lr.predictionCol: 'p'}, {lr.regParam: 3.0, lr.featuresCol: 'f', 
> >>> lr.maxIter: 5, lr.labelCol: 'l', lr.predictionCol: 'p'}]
> >>> len(output) == len(expected)
> True
> >>> all([m in expected for m in output])
> True
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to