Permalink
Browse files

Pull NNI construction into create_neural_net

  • Loading branch information...
1 parent f76c9b2 commit be3c8a51d08bf85825096fc98d495ed0201bbd2d @charmasaur charmasaur committed Dec 3, 2016
Showing with 8 additions and 2 deletions.
  1. +8 −2 mloop/learners.py
View
@@ -1670,6 +1670,13 @@ def __init__(self,
#Remove logger so gaussian process can be safely picked for multiprocessing on Windows
self.log = None
+ def create_neural_net(self):
+ '''
+ Creates the neural net. Must be called from the same process as fit_neural_net, predict_cost and predict_costs_from_param_array.
+ '''
+ import mloop.nnlearner as mlnn
+ self.neural_net_impl = mlnn.NeuralNetImpl(self.num_params)
+
def fit_neural_net(self):
'''
Determine the appropriate number of layers for the NN given the data.
@@ -1871,8 +1878,7 @@ def run(self):
self.log = mp.log_to_stderr(logging.WARNING)
# The network needs to be created in the same process in which it runs
- import mloop.nnlearner as mlnn
- self.neural_net_impl = mlnn.NeuralNetImpl(self.num_params)
+ self.create_neural_net()
try:
while not self.end_event.is_set():

0 comments on commit be3c8a5

Please sign in to comment.