Get the parameters and costs from the queue and place in their appropriate all_[type] arrays. Also updates bad costs, best parameters, and search boundaries given trust region.
'''
ifself.costs_in_queue.empty():
- self.log.error('Gaussian process asked for new parameters but no new costs were provided.')
+ self.log.error('Neural network asked for new parameters but no new costs were provided.')
- self.log.error('Incorrect number of parameters provided to Gaussian process learner:'+repr(param) +'. Number of parameters:'+str(self.num_params))
+ self.log.error('Incorrect number of parameters provided to neural network learner:'+repr(param) +'. Number of parameters:'+str(self.num_params))
raiseValueError
ifnotself.check_in_boundary(param):
- self.log.warning('Parameters provided to Gaussian process learner not in boundaries:'+repr(param))
+ self.log.warning('Parameters provided to neural network learner not in boundaries:'+repr(param))
cost =float(cost)
if uncer <0:
self.log.error('Provided uncertainty must be larger or equal to zero:'+repr(uncer))
@@ -1821,26 +1820,26 @@ def update_archive(self):
deffind_next_parameters(self):
'''
- Returns next parameters to find. Increments counters and bias function appropriately.
+ Returns next parameters to find. Increments counters appropriately.
Return:
- next_params (array): Returns next parameters from biased cost search.
+ next_params (array): Returns next parameters from cost search.
'''
+ #TODO: We could implement some other type of biasing.
self.params_count +=1
- self.update_bias_function()
self.update_search_params()
next_params =None
next_cost =float('inf')
for start_params inself.search_params:
- result = so.minimize(self.predict_biased_cost, start_params, bounds=self.search_region, tol=self.search_precision)
+ result = so.minimize(self.predict_cost, start_params, bounds=self.search_region, tol=self.search_precision)
if result.fun < next_cost:
next_params = result.x
next_cost = result.fun
return next_params
defrun(self):
'''
- Starts running the Gaussian process learner. When the new parameters event is triggered, reads the cost information provided and updates the Gaussian process with the information. Then searches the Gaussian process for new optimal parameters to test based on the biased cost. Parameters to test next are put on the output parameters queue.
+ Starts running the neural network learner. When the new parameters event is triggered, reads the cost information provided and updates the neural network with the information. Then searches the neural network for new optimal parameters to test based on the biased cost. Parameters to test next are put on the output parameters queue.
'''
#logging to the main log file from a process (as apposed to a thread) in cpython is currently buggy on windows and/or python 2.7
#current solution is to only log to the console for warning and above from a process
@@ -1855,7 +1854,7 @@ def run(self):
self.get_params_and_costs()
self.fit_neural_net()
for _ inrange(self.generation_num):
- self.log.debug('Gaussian process learner generating parameter:'+str(self.params_count+1))
0 comments on commit
6a6f663