Skip to content

Commit bc25129

Browse files
committed
Add frnn_minimize minimizing function to HyperRunner class
1 parent 5c925a1 commit bc25129

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plasma/models/runner.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,26 @@ def get_space(self):
178178
'Dropout': hp.uniform('Dropout', 0, 1),
179179
}
180180

181+
def frnn_minimize(self, algo, max_evals, trials, rseed=1337):
182+
from hyperopt import fmin
183+
184+
best_run = fmin(self.keras_fmin_fnct,
185+
space=self.get_space(),
186+
algo=algo,
187+
max_evals=max_evals,
188+
trials=trials,
189+
rstate=np.random.RandomState(rseed))
190+
191+
best_model = None
192+
for trial in trials:
193+
vals = trial.get('misc').get('vals')
194+
for key in vals.keys():
195+
vals[key] = vals[key][0]
196+
if trial.get('misc').get('vals') == best_run and 'model' in trial.get('result').keys():
197+
best_model = trial.get('result').get('model')
198+
199+
return best_run, best_model
200+
181201
def plot_losses(conf,losses_list,specific_builder,name=''):
182202
unique_id = specific_builder.get_unique_id()
183203
savedir = 'losses'

0 commit comments

Comments
 (0)