From 56de5717c258b90ea5b02a6e4263f365f39628f6 Mon Sep 17 00:00:00 2001 From: Xiangrui Meng Date: Wed, 21 Jan 2015 16:53:58 -0800 Subject: [PATCH] fix style --- .../ml/simple_text_classification_pipeline.py | 18 +++++++++--------- python/pyspark/ml/__init__.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/src/main/python/ml/simple_text_classification_pipeline.py b/examples/src/main/python/ml/simple_text_classification_pipeline.py index eb80f44f4fa97..f457ce97a42d1 100644 --- a/examples/src/main/python/ml/simple_text_classification_pipeline.py +++ b/examples/src/main/python/ml/simple_text_classification_pipeline.py @@ -29,20 +29,20 @@ sc.parallelize([(0L, "a b c d e spark", 1.0), (1L, "b d", 0.0), (2L, "spark f g h", 1.0), - (3L, "hadoop mapreduce", 0.0)]) \ + (3L, "hadoop mapreduce", 0.0)]) .map(lambda x: Row(id=x[0], text=x[1], label=x[2]))) tokenizer = Tokenizer() \ - .setInputCol("text") \ - .setOutputCol("words") + .setInputCol("text") \ + .setOutputCol("words") hashingTF = HashingTF() \ - .setInputCol(tokenizer.getOutputCol()) \ - .setOutputCol("features") + .setInputCol(tokenizer.getOutputCol()) \ + .setOutputCol("features") lr = LogisticRegression() \ - .setMaxIter(10) \ - .setRegParam(0.01) + .setMaxIter(10) \ + .setRegParam(0.01) pipeline = Pipeline() \ - .setStages([tokenizer, hashingTF, lr]) + .setStages([tokenizer, hashingTF, lr]) model = pipeline.fit(training) @@ -50,7 +50,7 @@ sc.parallelize([(4L, "spark i j k"), (5L, "l m n"), (6L, "mapreduce spark"), - (7L, "apache hadoop")]) \ + (7L, "apache hadoop")]) .map(lambda x: Row(id=x[0], text=x[1]))) for row in model.transform(test).collect(): diff --git a/python/pyspark/ml/__init__.py b/python/pyspark/ml/__init__.py index 1cf9d3065f3d1..3b2ab269d9f21 100644 --- a/python/pyspark/ml/__init__.py +++ b/python/pyspark/ml/__init__.py @@ -18,7 +18,7 @@ from abc import ABCMeta, abstractmethod, abstractproperty from pyspark import SparkContext -from pyspark.sql import SchemaRDD, inherit_doc # TODO: move inherit_doc to Spark Core +from pyspark.sql import SchemaRDD, inherit_doc # TODO: move inherit_doc to Spark Core from pyspark.ml.param import Param, Params from pyspark.ml.util import Identifiable