# ------ plot testing ------ y = np.concatenate([ training_scaler_Y.inverse_transform(trainingY), training_scaler_Y.inverse_transform(testY) ]) y_true = y.reshape(y.shape[0], ) yhats_training_mean_conv = yhats_training_mean_conv.reshape( yhats_training_mean_conv.shape[0], ) yhats_training_std = yhats_training_std.reshape(yhats_training_std.shape[0], ) yhats_training_sem = yhats_training_sem.reshape(yhats_training_sem.shape[0], ) yhats_test_mean_conv = yhats_test_mean_conv.reshape( yhats_test_mean_conv.shape[0], ) yhats_test_std = yhats_test_std.reshape(yhats_test_std.shape[0], ) yhats_test_sem = yhats_test_sem.reshape(yhats_test_sem.shape[0], ) y_yhat_plot(filepath=os.path.join( res_dir, 'new_lstm_phase1_base_scatter_freq' + str(freq) + '.pdf'), y_true=y_true, training_yhat=yhats_training_mean_conv, training_yhat_err=yhats_training_std, test_yhat=yhats_test_mean_conv, test_yhat_err=yhats_test_std, plot_title='Cross-validation prediction', ylabel='PCL', xlabel='Subjects', plot_type='scatter', bar_width=0.25) # ------ true test realm ------
yhats_trainingX_pred = yhats_trainingX_pred.reshape( yhats_trainingX_pred.shape[0], ) yhats_trainingX_std = yhats_trainingX_std.reshape( yhats_trainingX_std.shape[0], ) yhats_trainingX_sem = yhats_trainingX_sem.reshape( yhats_trainingX_sem.shape[0], ) yhats_testX_pred = yhats_testX_pred.reshape(yhats_testX_pred.shape[0], ) yhats_testX_std = yhats_testX_std.reshape(yhats_testX_std.shape[0], ) yhats_testX_sem = yhats_testX_sem.reshape(yhats_testX_sem.shape[0], ) y_yhat_plot(filepath=os.path.join(res_dir, 'new_freq1_cv_plot_scatter_test.pdf'), y_true=y_true, training_yhat=yhats_trainingX_pred, training_yhat_err=yhats_trainingX_std, test_yhat=yhats_testX_pred, test_yhat_err=yhats_testX_std, plot_title='Cross-validation prediction', ylabel='PCL', xlabel='Subjects', plot_type='scatter', bar_width=0.25) # ------ training/test subject split for all the frquencies ------ # theta training, test, scaler_X, scaler_Y = training_test_spliter( data=raw, man_split=True, man_split_colname='subject', man_split_testset_value=['PN14', 'PN27', 'PP13'], min_max_scaling=True, scale_column_as_y=['PCL'],
training_y_hat, test_y_hat = inverse_norm_y(training_y=training_y_hat, test_y=test_y_hat, scaler=scaler_Y) # ---- plot # -- data for plotting # NOTE: run once! y_plot = np.concatenate([lstm_training_y, lstm_test_y]) y_plot = scaler_Y.inverse_transform(y_plot.reshape(y_plot.shape[0], 1)) y_plot = y_plot.reshape(y_plot.shape[0], ) # -- plotting y_yhat_plot(filepath=os.path.join(res_dir, freq + '_simple.performance.pdf'), y_true=y_plot, training_yhat=training_y_hat, test_yhat=test_y_hat, plot_title='Simple LSTM model prediction plot', ylabel='PCL', xlabel='Subjects', plot_style='classic') # for enc-dec model training_y_hat = training_y_hat.reshape(training_y_hat.shape[0], ) test_y_hat = test_y_hat.reshape(test_y_hat.shape[0], ) y_yhat_plot(filepath=os.path.join(res_dir, freq + '_enc-dec.performance.pdf'), y_true=y_plot, training_yhat=training_y_hat, test_yhat=test_y_hat, plot_title='Encoder-Decoder LSTM model prediction plot', ylabel='PCL', xlabel='Subjects', plot_type='bar',