diff --git a/sklearn/fml/constants.py b/sklearn/fml/constants.py index ae41a4d5ce215..8370dda1f7284 100644 --- a/sklearn/fml/constants.py +++ b/sklearn/fml/constants.py @@ -3,7 +3,8 @@ class URI: _METRIC = '/metric' _RETRIEVE = '/retrieve' - _BEST = '/best' + _MAX = '/max' + _MIN = '/min' _ALL = '/all' def post_metric(self): @@ -12,5 +13,8 @@ def post_metric(self): def retrieve_all(self): return self._SERVER + self._METRIC + self._RETRIEVE + self._ALL - def retrieve_best(self): - return self._SERVER + self._METRIC + self._RETRIEVE + self._BEST + def retrieve_best_min(self): + return self._SERVER + self._METRIC + self._RETRIEVE + self._MIN + + def retrieve_best_max(self): + return self._SERVER + self._METRIC + self._RETRIEVE + self._MAX diff --git a/sklearn/fml/fml_client.py b/sklearn/fml/fml_client.py index 2c805a5c10356..282acf686a8ff 100644 --- a/sklearn/fml/fml_client.py +++ b/sklearn/fml/fml_client.py @@ -50,16 +50,22 @@ def retrieve_all_metrics(self, dataset): return self._post_msg(URI().retrieve_all(), data) - def retrieve_best_metric(self, dataset): + def retrieve_best_metric(self, dataset, min=True): """ Function to retrieve metric that best matches the dataset_hash + @min = True fetch the minimum value of the metric + @min = False fetches the maximum value of the metric """ dataset_hash = FMLHash().hashValAndReturnString(dataset) data = {} data['dataset_hash'] = dataset_hash - return self._post_msg(URI().retrieve_best(), data) + if min: + return self._post_msg(URI().retrieve_best_min(), data) + else: + return self._post_msg(URI().retrieve_best_max(), data) + def _test_publish(self, model=linear_model.LinearRegression(), metric_name='RMSE', metric_value='0', dataset='asdfasdfasdfd'): """