[SPARK-7431] [ML] [PYTHON] Made CrossValidatorModel call parent init in PySpark

Fixes bug with PySpark cvModel not having UID
Also made small PySpark fixes: Evaluator should inherit from Params.  MockModel should inherit from Model.

CC: mengxr

Author: Joseph K. Bradley <joseph@databricks.com>

Closes #5968 from jkbradley/pyspark-cv-uid and squashes the following commits:

57f13cd [Joseph K. Bradley] Made CrossValidatorModel call parent init in PySpark

(cherry picked from commit 3038443e58)
Signed-off-by: Joseph K. Bradley <joseph@databricks.com>
This commit is contained in:
Joseph K. Bradley 2015-05-10 13:29:27 -07:00
parent fd87b2aec3
commit d49b72c238
3 changed files with 4 additions and 3 deletions

View file

@ -179,7 +179,7 @@ class PipelineModel(Model):
return dataset
class Evaluator(object):
class Evaluator(Params):
"""
Base class for evaluators that compute metrics from predictions.
"""

View file

@ -34,7 +34,7 @@ from pyspark.tests import ReusedPySparkTestCase as PySparkTestCase
from pyspark.sql import DataFrame
from pyspark.ml.param import Param
from pyspark.ml.param.shared import HasMaxIter, HasInputCol
from pyspark.ml.pipeline import Transformer, Estimator, Pipeline
from pyspark.ml.pipeline import Estimator, Model, Pipeline, Transformer
class MockDataset(DataFrame):
@ -77,7 +77,7 @@ class MockEstimator(Estimator):
return model
class MockModel(MockTransformer, Transformer):
class MockModel(MockTransformer, Model):
def __init__(self):
super(MockModel, self).__init__()

View file

@ -236,6 +236,7 @@ class CrossValidatorModel(Model):
"""
def __init__(self, bestModel):
super(CrossValidatorModel, self).__init__()
#: best model from cross validation
self.bestModel = bestModel