'self.c * self.acc_phone_y + self.d * self.acc_phone_z', 'self.e * self.acc_phone_x + self.f * self.acc_phone_z' ], ['self.acc_phone_x', 'self.acc_phone_y'], ['self.a', 'self.b', 'self.c', 'self.d', 'self.e', 'self.f'], pop_size=5, max_generations=10, per_time_step=True) DataViz.plot_numerical_prediction_versus_real( train_X.index, train_y['acc_phone_x'], regr_train_y['acc_phone_x'], test_X.index, test_y['acc_phone_x'], regr_test_y['acc_phone_x'], 'acc_phone_x') regr_train_y, regr_test_y = learner.dynamical_systems_model_sa( train_X, train_y, test_X, test_y, ['self.acc_phone_x', 'self.acc_phone_y', 'self.acc_phone_z'], [ 'self.a * self.acc_phone_x + self.b * self.acc_phone_y', 'self.c * self.acc_phone_y + self.d * self.acc_phone_z', 'self.e * self.acc_phone_x + self.f * self.acc_phone_z' ], ['self.acc_phone_x', 'self.acc_phone_y'], ['self.a', 'self.b', 'self.c', 'self.d', 'self.e', 'self.f'], max_generations=10, per_time_step=True) DataViz.plot_numerical_prediction_versus_real( train_X.index, train_y['acc_phone_x'], regr_train_y['acc_phone_x'], test_X.index, test_y['acc_phone_x'], regr_test_y['acc_phone_x'], 'acc_phone_x')
# a list of columns the model addresses (i.e. the states), the string should be preceded by 'self.' in order for the approach to work. # a list of equations to derive the specified states, again using 'self.' preceding all parameters and columns names. # a list of targets (a subset of the columns) (again with 'self.') # a list of parameters in the equations (again with 'self.') performance_tr_dyn = 0 performance_tr_dyn_std = 0 performance_te_dyn = 0 performance_te_dyn_std = 0 for repeat in range(0, repeats): print '----', repeat regr_train_y, regr_test_y = learner.dynamical_systems_model_sa( selected_train_X, train_y.to_frame(name='hr_watch_rate'), selected_test_X, test_y.to_frame(name='hr_watch_rate'), columns, equations, targets, parameters) mean_tr, std_tr = eval.mean_squared_error_with_std( train_y.ix[washout_time:, ], regr_train_y.ix[washout_time:, ]) mean_te, std_te = eval.mean_squared_error_with_std( test_y.ix[washout_time:, ], regr_test_y.ix[washout_time:, ]) performance_tr_dyn += mean_tr performance_tr_dyn_std += std_tr performance_te_dyn += mean_te performance_te_dyn_std += std_te overall_performance_tr_dyn = performance_tr_dyn / repeats overall_performance_tr_dyn_std = performance_tr_dyn_std / repeats overall_performance_te_dyn = performance_te_dyn / repeats