Skip to content

Commit dcf7d73

Browse files
committed
add python doc
1 parent b18fd07 commit dcf7d73

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ private[python] class PythonMLLibAPI extends Serializable {
345345
val model = new GaussianMixtureModel(weight, gaussians)
346346
model.predictSoft(data)
347347
}
348-
349-
350-
348+
351349
/**
352350
* Java stub for Python mllib ALS.train(). This stub returns a handle
353351
* to the Java object instead of the content of the Java object. Extra care
@@ -408,10 +406,11 @@ private[python] class PythonMLLibAPI extends Serializable {
408406
}
409407

410408
/**
411-
* A Wrapper of FPGrowthModel to provide helpfer method for Python
409+
* A Wrapper of FPGrowthModel to provide helper method for Python
412410
*/
413411
private[python] class FPGrowthModelWrapper(model: FPGrowthModel[Any])
414412
extends FPGrowthModel(model.freqItemsets) {
413+
415414
def getFreqItemsets: RDD[Array[Any]] = {
416415
SerDe.fromTuple2RDD(model.freqItemsets.map(x => (x.javaItems, x.freq)))
417416
}
@@ -423,12 +422,13 @@ private[python] class PythonMLLibAPI extends Serializable {
423422
* needs to be taken in the Python code to ensure it gets freed on exit; see
424423
* the Py4J documentation.
425424
*/
426-
def trainFPGrowthModel(data: JavaRDD[java.lang.Iterable[Any]],
425+
def trainFPGrowthModel(
426+
data: JavaRDD[java.lang.Iterable[Any]],
427427
minSupport: Double,
428-
numPartition: Int): FPGrowthModel[Any] = {
428+
numPartitions: Int): FPGrowthModel[Any] = {
429429
val fpm = new FPGrowth()
430430
.setMinSupport(minSupport)
431-
.setNumPartitions(numPartition)
431+
.setNumPartitions(numPartitions)
432432

433433
val model = fpm.run(data.rdd.map(_.asScala.toArray))
434434
new FPGrowthModelWrapper(model)

python/docs/pyspark.mllib.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ pyspark.mllib.feature module
3131
:undoc-members:
3232
:show-inheritance:
3333

34+
pyspark.mllib.fpm module
35+
------------------------
36+
37+
.. automodule:: pyspark.mllib.fpm
38+
:members:
39+
:undoc-members:
40+
3441
pyspark.mllib.linalg module
3542
---------------------------
3643

python/pyspark/mllib/fpm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def freqItemsets(self):
5454
class FPGrowth(object):
5555

5656
@classmethod
57-
def train(cls, data, minSupport=0.3, numPartition=-1):
58-
model = callMLlibFunc("trainFPGrowthModel", data, float(minSupport), int(numPartition))
57+
def train(cls, data, minSupport=0.3, numPartitions=-1):
58+
model = callMLlibFunc("trainFPGrowthModel", data, float(minSupport), int(numPartitions))
5959
return FPGrowthModel(model)
6060

6161

0 commit comments

Comments
 (0)