Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Jan 22, 2015
1 parent d0c5bb8 commit 56de571
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
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)

test = sqlCtx.inferSchema(
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():
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/ml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 56de571

Please sign in to comment.