Skip to content

Commit

Permalink
local param gird (#94)
Browse files Browse the repository at this point in the history
local param gird. Fixes #96
  • Loading branch information
hengji-liu authored and NicolasHug committed Oct 6, 2017
1 parent b7a9a8f commit 973ec5b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions surprise/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __init__(self, algo_class, param_grid, measures=['rmse', 'mae'],
self.best_estimator = CaseInsensitiveDefaultDict(list)
self.cv_results = defaultdict(list)
self.algo_class = algo_class
self.param_grid = param_grid
self.param_grid = param_grid.copy()
self.measures = [measure.upper() for measure in measures]
self.n_jobs = n_jobs
self.pre_dispatch = pre_dispatch
Expand All @@ -187,20 +187,20 @@ def __init__(self, algo_class, param_grid, measures=['rmse', 'mae'],

# As sim_options and bsl_options are dictionaries, they require a
# special treatment.
if 'sim_options' in param_grid:
sim_options = param_grid['sim_options']
if 'sim_options' in self.param_grid:
sim_options = self.param_grid['sim_options']
sim_options_list = [dict(zip(sim_options, v)) for v in
product(*sim_options.values())]
param_grid['sim_options'] = sim_options_list
self.param_grid['sim_options'] = sim_options_list

if 'bsl_options' in param_grid:
bsl_options = param_grid['bsl_options']
if 'bsl_options' in self.param_grid:
bsl_options = self.param_grid['bsl_options']
bsl_options_list = [dict(zip(bsl_options, v)) for v in
product(*bsl_options.values())]
param_grid['bsl_options'] = bsl_options_list
self.param_grid['bsl_options'] = bsl_options_list

self.param_combinations = [dict(zip(param_grid, v)) for v in
product(*param_grid.values())]
self.param_combinations = [dict(zip(self.param_grid, v)) for v in
product(*self.param_grid.values())]

def evaluate(self, data):
"""Runs the grid search on dataset.
Expand Down

0 comments on commit 973ec5b

Please sign in to comment.