Source code for FindBestModel

# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in project root for information.

import sys
from pyspark import SQLContext
from pyspark import SparkContext

if sys.version >= '3':
    basestring = str

from mmlspark._FindBestModel import _FindBestModel
from mmlspark._FindBestModel import _BestModel
from pyspark.ml.wrapper import JavaParams
from pyspark.ml.common import inherit_doc

[docs]@inherit_doc class FindBestModel(_FindBestModel): def _create_model(self, java_model): model = BestModel() model._java_obj = java_model model._transfer_params_from_java() return model
[docs]@inherit_doc class BestModel(_BestModel):
[docs] def getBestModel(self): """ Returns the best model. """ return JavaParams._from_java(self._java_obj.getBestModel())
[docs] def getScoredDataset(self): """ Returns scored dataset for the best model. """ return self._java_obj.getScoredDataset()
[docs] def getEvaluationResults(self): """ Returns the ROC curve with TPR, FPR. """ return self._java_obj.getEvaluationResults()
[docs] def getBestModelMetrics(self): """ Returns all of the best model metrics results from the evaluator. """ return self._java_obj.getBestModelMetrics()
[docs] def getAllModelMetrics(self): """ Returns a table of metrics from all models compared from the evaluation comparison. """ return self._java_obj.getAllModelMetrics()