def __init__(self, user_name=None): self.noise = 0.1 self.start_recording = False self.stop_recording = False self.com = COM(load_net=True) if (not user_name == None): self.com.Options.setup(self.com.Options.root_dir, user_name) self.com.load_net() self.options = self.com.Options self.features = Features()
if(random() > 0.2): train_data.append(rollout_data) train_labels.append(filename) else: test_data.append(rollout_data) test_labels.append(filename) # if count == 0: # train_data.append(rollout_data) # count += 1 # else: # test_data.append(rollout_data) pickle.dump([train_labels,test_labels],open(Options.stats_dir+'/test_train_s.p','wb')) state_stats = [] features = Features() clf = linear_model.LinearRegression(n_jobs = -1) learner = Learner(features.hog_color,clf) learner.add_data(train_data,test_data) learner.train_model() train_loss,test_loss = learner.get_stats() stat = {} stat['type'] = 'color_hog_linear' stat['test_loss'] = test_loss stat['train_loss'] = train_loss state_stats.append(stat) print "TEST LOSS ",test_loss