You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by rishabhbhardwaj <gi...@git.apache.org> on 2015/11/02 11:07:12 UTC

[GitHub] spark pull request: [SPARK-11445][DOCS]Replaced example code in ml...

GitHub user rishabhbhardwaj opened a pull request:

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

    [SPARK-11445][DOCS]Replaced example code in mllib-ensembles.md using include_example

    I have made the required changes and tested.
    Kindly review the changes.

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

    $ git pull https://github.com/rishabhbhardwaj/spark SPARK-11445

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

    https://github.com/apache/spark/pull/9407.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 #9407
    
----
commit d152cb5ac855eeeac962a4b547f6f96522fd1223
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-10-19T06:42:56Z

    [ SPARK-11180 ] [ SQL ] DataFrame.na.fill does not support Boolean Type

commit a53a20d756cfd26ca37acf9dbbd0b4e034f430d8
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-10-20T09:50:28Z

    Merge remote-tracking branch 'upstream/master'

commit 870cbb384db84ffcc128114b38b495095e424ace
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-10-26T09:58:48Z

    Merge remote-tracking branch 'upstream/master'

commit a21b0ed6d86811e5eedff0e4634da010062d225b
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-10-29T08:57:54Z

    Merge remote-tracking branch 'upstream/master'

commit 079b1de9d6ddeeaf591a3707ecfffb1193d2a0f4
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-11-02T05:49:16Z

    Merge remote-tracking branch 'upstream/master'

commit 24e74e166db59bf10373e2867faa2db06cea5bb5
Author: Rishabh Bhardwaj <rb...@gmail.com>
Date:   2015-11-02T10:05:08Z

    [SPARK-11445] [DOCS] Replace example code in mllib-ensembles.md using include_example

----


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153251522
  
     Merged build triggered.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153231624
  
    Merged build started.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153166207
  
     Merged build triggered.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-156482166
  
    Merged into master and branch-1.6. 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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712588
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    --- End diff --
    
    blank line here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712397
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingClassificationExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesClassificationExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    --- End diff --
    
    sc -> jsc, change the following sc to jsc accordingly.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712185
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    --- End diff --
    
    Add a blank line below here.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

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


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712968
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestClassificationExample.java ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    --- End diff --
    
    blank lines according to spark scala style guide


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712809
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestClassificationExample.java ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.RandomForest;
    +import org.apache.spark.mllib.tree.model.RandomForestModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    --- End diff --
    
    blank line


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43716053
  
    --- Diff: examples/src/main/python/mllib/gradient_boosting_regression_example.py ---
    @@ -0,0 +1,56 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Gradient Boosted Trees Regression Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    +# $example off#
    +if __name__ == "__main__":
    +    # $example on$
    +    # Load and parse the data file.
    +    data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
    +    # Split the data into training and test sets (30% held out for testing)
    +    (trainingData, testData) = data.randomSplit([0.7, 0.3])
    +
    +    # Train a GradientBoostedTrees model.
    +    #  Notes: (a) Empty categoricalFeaturesInfo indicates all features are continuous.
    +    #         (b) Use more iterations in practice.
    +    model = GradientBoostedTrees.trainRegressor(trainingData,
    +                                                categoricalFeaturesInfo={}, numIterations=3)
    +
    +    # Evaluate model on test instances and compute test error
    +    predictions = model.predict(testData.map(lambda x: x.features))
    +    labelsAndPredictions = testData.map(lambda lp: lp.label).zip(predictions)
    +    testMSE = labelsAndPredictions.map(lambda (v, p): (v - p) * (v - p)).sum() /
    --- End diff --
    
    invalid syntax, add a `\` at the end


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43715899
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/RandomForestRegressionExample.scala ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.{SparkContext, SparkConf}
    +// $example on$
    +import org.apache.spark.mllib.tree.RandomForest
    +import org.apache.spark.mllib.tree.model.RandomForestModel
    +import org.apache.spark.mllib.util.MLUtils
    +// $example off$
    +
    +object RandomForestRegressionExample {
    +  def main(args: Array[String]) {
    --- End diff --
    
    ditto


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153251456
  
    @yinxusen Made the changes.Also ran the python files and they are working fine.Thanks for your inputs.WIll keep these points in mind from next time.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712196
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    --- End diff --
    
    blank line below here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712573
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingClassificationExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesClassificationExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    +
    +    // Load and parse the data file.
    +    String datapath = "data/mllib/sample_libsvm_data.txt";
    +    JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(sc.sc(), datapath).toJavaRDD();
    +    // Split the data into training and test sets (30% held out for testing)
    +    JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[]{0.7, 0.3});
    +    JavaRDD<LabeledPoint> trainingData = splits[0];
    +    JavaRDD<LabeledPoint> testData = splits[1];
    +
    +    // Train a GradientBoostedTrees model.
    +    //  The defaultParams for Classification use LogLoss by default.
    +    BoostingStrategy boostingStrategy = BoostingStrategy.defaultParams("Classification");
    +    boostingStrategy.setNumIterations(3); // Note: Use more iterations in practice.
    +    boostingStrategy.getTreeStrategy().setNumClasses(2);
    +    boostingStrategy.getTreeStrategy().setMaxDepth(5);
    +    //  Empty categoricalFeaturesInfo indicates all features are continuous.
    +    Map<Integer, Integer> categoricalFeaturesInfo = new HashMap<Integer, Integer>();
    +    boostingStrategy.treeStrategy().setCategoricalFeaturesInfo(categoricalFeaturesInfo);
    +
    +    final GradientBoostedTreesModel model =
    +      GradientBoostedTrees.train(trainingData, boostingStrategy);
    +
    +    // Evaluate model on test instances and compute test error
    +    JavaPairRDD<Double, Double> predictionAndLabel =
    +      testData.mapToPair(new PairFunction<LabeledPoint, Double, Double>() {
    +        @Override
    +        public Tuple2<Double, Double> call(LabeledPoint p) {
    +          return new Tuple2<Double, Double>(model.predict(p.features()), p.label());
    +        }
    +      });
    +    Double testErr =
    +      1.0 * predictionAndLabel.filter(new Function<Tuple2<Double, Double>, Boolean>() {
    +        @Override
    +        public Boolean call(Tuple2<Double, Double> pl) {
    +          return !pl._1().equals(pl._2());
    +        }
    +      }).count() / testData.count();
    +    System.out.println("Test Error: " + testErr);
    +    System.out.println("Learned classification GBT model:\n" + model.toDebugString());
    +
    +    // Save and load model
    +    model.save(sc.sc(), "target/tmp/myGradientBoostingClassificationModel");
    +    GradientBoostedTreesModel sameModel = GradientBoostedTreesModel.load(sc.sc(),
    +      "target/tmp/myGradientBoostingClassificationModel");
    +  }
    --- End diff --
    
    swap the two lines. I think it should be 
    
    ```scala
        // $example off$
      }
    ```


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153166239
  
    Merged build started.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153256020
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44883/
    Test PASSed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712748
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.function.Function2;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingRegressionExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesRegressionExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    --- End diff --
    
    sc -> jsc


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153233284
  
    **[Test build #44872 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44872/consoleFull)** for PR 9407 at commit [`a71e99b`](https://github.com/apache/spark/commit/a71e99b9bafacd9958d5fbc7eaa35e016cf5d886).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153170014
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44836/
    Test FAILed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153170011
  
    Merged build finished. Test FAILed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153233332
  
    Merged build finished. Test PASSed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712849
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestClassificationExample.java ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    --- End diff --
    
    blank lines according to spark scala style guide


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712498
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingClassificationExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesClassificationExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    +
    +    // Load and parse the data file.
    +    String datapath = "data/mllib/sample_libsvm_data.txt";
    +    JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(sc.sc(), datapath).toJavaRDD();
    +    // Split the data into training and test sets (30% held out for testing)
    +    JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[]{0.7, 0.3});
    +    JavaRDD<LabeledPoint> trainingData = splits[0];
    +    JavaRDD<LabeledPoint> testData = splits[1];
    +
    +    // Train a GradientBoostedTrees model.
    +    //  The defaultParams for Classification use LogLoss by default.
    +    BoostingStrategy boostingStrategy = BoostingStrategy.defaultParams("Classification");
    +    boostingStrategy.setNumIterations(3); // Note: Use more iterations in practice.
    +    boostingStrategy.getTreeStrategy().setNumClasses(2);
    +    boostingStrategy.getTreeStrategy().setMaxDepth(5);
    +    //  Empty categoricalFeaturesInfo indicates all features are continuous.
    --- End diff --
    
    ditto


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153231744
  
    **[Test build #44872 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44872/consoleFull)** for PR 9407 at commit [`a71e99b`](https://github.com/apache/spark/commit/a71e99b9bafacd9958d5fbc7eaa35e016cf5d886).


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712881
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.api.java.function.Function2;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.RandomForest;
    +import org.apache.spark.mllib.tree.model.RandomForestModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +import org.apache.spark.SparkConf;
    +// $example off$
    --- End diff --
    
    same issue with previous code files.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43715956
  
    --- Diff: examples/src/main/python/mllib/gradient_boosting_classification_example.py ---
    @@ -0,0 +1,55 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Gradient Boosted Trees Classification Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    --- End diff --
    
    blank line


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-152977040
  
    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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43716108
  
    --- Diff: examples/src/main/python/mllib/random_forest_regression_example.py ---
    @@ -0,0 +1,57 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Random Forest Regression Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import RandomForest, RandomForestModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    --- End diff --
    
    blank line here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153252332
  
    **[Test build #44883 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44883/consoleFull)** for PR 9407 at commit [`29a8067`](https://github.com/apache/spark/commit/29a8067cee1ef3f047ff3e2248de812f3e1453fb).


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712288
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    --- End diff --
    
    You need to add some blank lines in imports. See [code style guide](https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide).


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712492
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingClassificationExample.java ---
    @@ -0,0 +1,87 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingClassificationExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesClassificationExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    +
    +    // Load and parse the data file.
    +    String datapath = "data/mllib/sample_libsvm_data.txt";
    +    JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(sc.sc(), datapath).toJavaRDD();
    +    // Split the data into training and test sets (30% held out for testing)
    +    JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[]{0.7, 0.3});
    +    JavaRDD<LabeledPoint> trainingData = splits[0];
    +    JavaRDD<LabeledPoint> testData = splits[1];
    +
    +    // Train a GradientBoostedTrees model.
    +    //  The defaultParams for Classification use LogLoss by default.
    --- End diff --
    
    Use the same indent with the previous comment.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43716061
  
    --- Diff: examples/src/main/python/mllib/gradient_boosting_regression_example.py ---
    @@ -0,0 +1,56 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Gradient Boosted Trees Regression Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    +# $example off#
    +if __name__ == "__main__":
    +    # $example on$
    +    # Load and parse the data file.
    +    data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
    +    # Split the data into training and test sets (30% held out for testing)
    +    (trainingData, testData) = data.randomSplit([0.7, 0.3])
    +
    +    # Train a GradientBoostedTrees model.
    +    #  Notes: (a) Empty categoricalFeaturesInfo indicates all features are continuous.
    +    #         (b) Use more iterations in practice.
    +    model = GradientBoostedTrees.trainRegressor(trainingData,
    +                                                categoricalFeaturesInfo={}, numIterations=3)
    +
    +    # Evaluate model on test instances and compute test error
    +    predictions = model.predict(testData.map(lambda x: x.features))
    +    labelsAndPredictions = testData.map(lambda lp: lp.label).zip(predictions)
    +    testMSE = labelsAndPredictions.map(lambda (v, p): (v - p) * (v - p)).sum() /
    +    float(testData.count())
    --- End diff --
    
    4 more indents here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43715979
  
    --- Diff: examples/src/main/python/mllib/gradient_boosting_regression_example.py ---
    @@ -0,0 +1,56 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Gradient Boosted Trees Regression Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    --- End diff --
    
    duplicated example off


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153255981
  
    **[Test build #44883 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44883/consoleFull)** for PR 9407 at commit [`29a8067`](https://github.com/apache/spark/commit/29a8067cee1ef3f047ff3e2248de812f3e1453fb).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:\n  * `public class JavaGradientBoostingClassificationExample `\n  * `public class JavaGradientBoostingRegressionExample `\n  * `public class JavaRandomForestClassificationExample `\n  * `public class JavaRandomForestRegressionExample `\n


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712742
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    --- End diff --
    
    see comment in the previous code file.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43715985
  
    --- Diff: examples/src/main/python/mllib/gradient_boosting_regression_example.py ---
    @@ -0,0 +1,56 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +"""
    +Gradient Boosted Trees Regression Example.
    +"""
    +from __future__ import print_function
    +
    +import sys
    +
    +from pyspark import SparkContext
    +# $example on$
    +from pyspark.mllib.tree import GradientBoostedTrees, GradientBoostedTreesModel
    +from pyspark.mllib.util import MLUtils
    +# $example off$
    +# $example off#
    --- End diff --
    
    blank line here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153233333
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44872/
    Test PASSed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153238115
  
    @rishabhbhardwaj One more thing, all of your Python code files have no definition of `sc`. Try to run the example after adding it as a single code file.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153165927
  
    ok to test


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712799
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.function.Function2;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaGradientBoostingRegressionExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf()
    +      .setAppName("JavaGradientBoostedTreesRegressionExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    +    // Load and parse the data file.
    +    String datapath = "data/mllib/sample_libsvm_data.txt";
    +    JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(sc.sc(), datapath).toJavaRDD();
    +    // Split the data into training and test sets (30% held out for testing)
    +    JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[]{0.7, 0.3});
    +    JavaRDD<LabeledPoint> trainingData = splits[0];
    +    JavaRDD<LabeledPoint> testData = splits[1];
    +
    +    // Train a GradientBoostedTrees model.
    +    //  The defaultParams for Regression use SquaredError by default.
    --- End diff --
    
    same indent with the previous comment.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153256019
  
    Merged build finished. Test PASSed.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712717
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    --- End diff --
    
    see comment in the previous code file.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712887
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.api.java.function.Function2;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.RandomForest;
    +import org.apache.spark.mllib.tree.model.RandomForestModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +import org.apache.spark.SparkConf;
    +// $example off$
    +public class JavaRandomForestRegressionExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf().setAppName("JavaRandomForestRegressionExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    +    // Load and parse the data file.
    +    String datapath = "data/mllib/sample_libsvm_data.txt";
    +    JavaRDD<LabeledPoint> data = MLUtils.loadLibSVMFile(sc.sc(), datapath).toJavaRDD();
    +    // Split the data into training and test sets (30% held out for testing)
    +    JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[]{0.7, 0.3});
    +    JavaRDD<LabeledPoint> trainingData = splits[0];
    +    JavaRDD<LabeledPoint> testData = splits[1];
    +
    +    // Set parameters.
    +    //  Empty categoricalFeaturesInfo indicates all features are continuous.
    --- End diff --
    
    same indent


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153251533
  
    Merged build started.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43715894
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/RandomForestClassificationExample.scala ---
    @@ -0,0 +1,67 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.{SparkContext, SparkConf}
    +// $example on$
    +import org.apache.spark.mllib.tree.RandomForest
    +import org.apache.spark.mllib.tree.model.RandomForestModel
    +import org.apache.spark.mllib.util.MLUtils
    +// $example off$
    +
    +object RandomForestClassificationExample {
    +  def main(args: Array[String]) {
    --- End diff --
    
    `def main(args: Array[String]): Unit = {`


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153165976
  
    @yinxusen Could you help review 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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712856
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaRandomForestClassificationExample.java ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.HashMap;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.RandomForest;
    +import org.apache.spark.mllib.tree.model.RandomForestModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    +public class JavaRandomForestClassificationExample {
    +  public static void main(String[] args) {
    +    // $example on$
    +    SparkConf sparkConf = new SparkConf().setAppName("JavaRandomForestClassificationExample");
    +    JavaSparkContext sc = new JavaSparkContext(sparkConf);
    --- End diff --
    
    sc -> jsc


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153231485
  
    @yinxusen Thanks for your comments.Have made the required changes in the files you pointed and others also.Please review.


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9407#discussion_r43712726
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaGradientBoostingRegressionExample.java ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +// $example on$
    +import java.util.HashMap;
    +import java.util.Map;
    +import scala.Tuple2;
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.function.Function2;
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +import org.apache.spark.api.java.function.PairFunction;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import org.apache.spark.mllib.tree.GradientBoostedTrees;
    +import org.apache.spark.mllib.tree.configuration.BoostingStrategy;
    +import org.apache.spark.mllib.tree.model.GradientBoostedTreesModel;
    +import org.apache.spark.mllib.util.MLUtils;
    +// $example off$
    --- End diff --
    
    blank line here


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-154289480
  
    @mengxr LGTM


---
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: [SPARK-11445][DOCS]Replaced example code in ml...

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

    https://github.com/apache/spark/pull/9407#issuecomment-153231608
  
     Merged build triggered.


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