import matplotlib.pyplot as plt import numpy as np from figure_creation.figure_helpers import load_object, get_plot_data, get_smoothed_data error_raw_iters, error_raw_vals = load_object( './raw_data/sum_squares_error.pkl') num_vals = len(error_raw_iters) - 100000 smoothed_train_error_values = get_smoothed_data(error_raw_vals[:num_vals], 35000) plt.figure() plt.ylim((0, max(smoothed_train_error_values) + 0.01)) plt.plot(error_raw_iters[:num_vals], smoothed_train_error_values, c='b') plt.xlabel('Iterations') plt.ylabel('Training Error') plt.savefig('figure2.pdf', bbox_inches='tight') plt.show()
'./raw_data/fb_plas_0-001/sum_squares_error.pkl') #error_fb_plas_0_00075_vals_iters, error_fb_plas_0_00075_vals = load_object('./raw_data/fb_plas_0-00075/sum_squares_error.pkl') error_fb_plas_0_0005_vals_iters, error_fb_plas_0_0005_vals = load_object( './raw_data/fb_plas_0-0005/sum_squares_error.pkl') error_fb_plas_0_00025_vals_iters, error_fb_plas_0_00025_vals = load_object( './raw_data/fb_plas_0-00025/sum_squares_error.pkl') error_fb_plas_0_000125_vals_iters, error_fb_plas_0_000125_vals = load_object( './raw_data/fb_plas_0-000125/sum_squares_error.pkl') error_fb_plas_0_0000625_vals_iters, error_fb_plas_0_0000625_vals = load_object( './raw_data/fb_plas_0-0000625/sum_squares_error.pkl') error_fb_plas_0_00003125_vals_iters, error_fb_plas_0_00003125_vals = load_object( './raw_data/fb_plas_0-00003125/sum_squares_error.pkl') error_fb_align_vals_iters, error_fb_align_feedback_vals = load_object( './raw_data/fb_align/sum_squares_error.pkl') error_fb_plas_0_001_vals = get_smoothed_data(error_fb_plas_0_001_vals, 2500) error_fb_plas_0_0005_vals = get_smoothed_data(error_fb_plas_0_0005_vals, 2500) error_fb_plas_0_00025_vals = get_smoothed_data(error_fb_plas_0_00025_vals, 2500) error_fb_plas_0_000125_vals = get_smoothed_data(error_fb_plas_0_000125_vals, 2500) error_fb_plas_0_0000625_vals = get_smoothed_data(error_fb_plas_0_0000625_vals, 2500) error_fb_plas_0_00003125_vals = get_smoothed_data( error_fb_plas_0_00003125_vals, 2500) error_fb_align_feedback_vals = get_smoothed_data(error_fb_align_feedback_vals, 2500) num_vals = len(error_fb_align_vals_iters) plt.figure()
noise_0_45_layer_1_feedforward_feedback_weight_angle_iters, noise_0_45_layer_1_feedforward_feedback_weight_angle_vals = load_append_data( './raw_data/noise0-45/layer_1_feedforward_feedback_weight_angle', 3) noise_0_60_layer_1_feedforward_feedback_weight_angle_iters, noise_0_60_layer_1_feedforward_feedback_weight_angle_vals = load_append_data( './raw_data/noise0-60/layer_1_feedforward_feedback_weight_angle', 3) noise_0_90_layer_1_feedforward_feedback_weight_angle_iters, noise_0_90_layer_1_feedforward_feedback_weight_angle_vals = load_append_data( './raw_data/noise0-90/layer_1_feedforward_feedback_weight_angle', 3) noise_1_20_layer_1_feedforward_feedback_weight_angle_iters, noise_1_20_layer_1_feedforward_feedback_weight_angle_vals = load_append_data( './raw_data/noise1-20/layer_1_feedforward_feedback_weight_angle', 3) num_vals = len( noiseless_layer_1_feedforward_feedback_weight_angle_iters) - 15000 #smoothed_target_values = get_smoothed_data(target_potential_vals[:num_vals:5], 35000) smoothed_noiseless_layer_1_feedforward_feedback_weight_angle_values = get_smoothed_data( noiseless_layer_1_feedforward_feedback_weight_angle_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_15_layer_1_feedforward_feedback_weight_angle_values = get_smoothed_data( noise_0_15_layer_1_feedforward_feedback_weight_angle_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_30_layer_1_feedforward_feedback_weight_angle_values = get_smoothed_data( noise_0_30_layer_1_feedforward_feedback_weight_angle_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_45_layer_1_feedforward_feedback_weight_angle_values = get_smoothed_data( noise_0_45_layer_1_feedforward_feedback_weight_angle_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_60_layer_1_feedforward_feedback_weight_angle_values = get_smoothed_data(
file_base = '/monitors/' save_location_base = 'C:/Users/Will/PycharmProjects/MScProject/figure_creation/target_network_noise/raw_data/' train_errors = [] test_errors = [] for folder in folders: path_base = folder_base + folder best_test_error = np.inf best_train_error = np.inf for i, sub_folder in enumerate(sub_folders): src_path = path_base + sub_folder + file_base + 'sum_squares_error.pkl' data = load_object(src_path)[1] test_error = np.mean(data[-1000:]) smoothed_error = get_smoothed_data(data, 35000) min_training_error = np.min(smoothed_error) best_train_error = min(min_training_error, best_train_error) best_test_error = min(best_test_error, test_error) print(test_error, min_training_error, folder, sub_folder) print(best_test_error, folder, 'best') print() train_errors += [best_train_error] test_errors += [best_test_error] import matplotlib.pyplot as plt #plt.plot([0, 0.15, 0.30, 0.45, 0.6, 0.9, 1.2], [0.09022911465989959, 0.08967617669387362, 0.08861968903256999, 0.08699136676083595, 0.08551288832369616, 0.13205351973933888, 0.12959720375218972]) plt.figure()
noise_0_15_layer_1_weight_magnitudes_iters, noise_0_15_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise0-15/layer_1_feedforward_predict_weight_angle', 3) noise_0_30_layer_1_weight_magnitudes_iters, noise_0_30_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise0-30/layer_1_feedforward_predict_weight_angle', 3) noise_0_45_layer_1_weight_magnitudes_iters, noise_0_45_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise0-45/layer_1_feedforward_predict_weight_angle', 3) noise_0_60_layer_1_weight_magnitudes_iters, noise_0_60_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise0-60/layer_1_feedforward_predict_weight_angle', 3) noise_0_90_layer_1_weight_magnitudes_iters, noise_0_90_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise0-90/layer_1_feedforward_predict_weight_angle', 3) noise_1_20_layer_1_weight_magnitudes_iters, noise_1_20_layer_1_weight_magnitudes_vals = load_append_data( './raw_data/noise1-20/layer_1_feedforward_predict_weight_angle', 3) num_vals = len(noiseless_layer_1_weight_magnitudes_iters) - 15000 smoothed_noiseless_layer_1_weight_magnitudes_values = get_smoothed_data( noiseless_layer_1_weight_magnitudes_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_15_layer_1_weight_magnitudes_values = get_smoothed_data( noise_0_15_layer_1_weight_magnitudes_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_30_layer_1_weight_magnitudes_values = get_smoothed_data( noise_0_30_layer_1_weight_magnitudes_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_45_layer_1_weight_magnitudes_values = get_smoothed_data( noise_0_45_layer_1_weight_magnitudes_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_60_layer_1_weight_magnitudes_values = get_smoothed_data( noise_0_60_layer_1_weight_magnitudes_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_90_layer_1_weight_magnitudes_values = get_smoothed_data( noise_0_90_layer_1_weight_magnitudes_vals[:num_vals:5], 35000)
noise_0_15_error_raw_vals_iters, noise_0_15_error_raw_vals_vals = load_append_data( './raw_data/noise0-15/sum_squares_error', 3) noise_0_30_error_raw_vals_iters, noise_0_30_error_raw_vals_vals = load_append_data( './raw_data/noise0-30/sum_squares_error', 3) noise_0_45_error_raw_vals_iters, noise_0_45_error_raw_vals_vals = load_append_data( './raw_data/noise0-45/sum_squares_error', 3) noise_0_60_error_raw_vals_iters, noise_0_60_error_raw_vals_vals = load_append_data( './raw_data/noise0-60/sum_squares_error', 3) noise_0_90_error_raw_vals_iters, noise_0_90_error_raw_vals_vals = load_append_data( './raw_data/noise0-90/sum_squares_error', 3) noise_1_20_error_raw_vals_iters, noise_1_20_error_raw_vals_vals = load_append_data( './raw_data/noise1-20/sum_squares_error', 3) num_vals = len(noiseless_error_raw_vals_iters) - 15000 smoothed_noiseless_train_error_values = get_smoothed_data( noiseless_error_raw_vals_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_15_train_error_values = get_smoothed_data( noise_0_15_error_raw_vals_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_30_train_error_values = get_smoothed_data( noise_0_30_error_raw_vals_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_45_train_error_values = get_smoothed_data( noise_0_45_error_raw_vals_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_60_train_error_values = get_smoothed_data( noise_0_60_error_raw_vals_vals[:num_vals:5], 35000) print("1") smoothed_noise_0_90_train_error_values = get_smoothed_data( noise_0_90_error_raw_vals_vals[:num_vals:5], 35000)
import matplotlib.pyplot as plt import numpy as np from figure_creation.figure_helpers import load_object, get_smoothed_data layer_1_backprop_angle_iters, layer_1_backprop_angle_vals = load_object('./raw_data/layer_1_backprop_update_angle.pkl') smoothed_layer_1_backprop_angle_vals = get_smoothed_data(layer_1_backprop_angle_vals, 200) layer_2_backprop_angle_iters, layer_2_backprop_angle_vals = load_object('./raw_data/layer_2_backprop_update_angle.pkl') smoothed_layer_2_backprop_angle_vals = get_smoothed_data(layer_2_backprop_angle_vals, 200) plt.figure() plt.xlim((0, layer_1_backprop_angle_iters[-1])) plt.ylim((40, 140)) plt.plot(layer_1_backprop_angle_iters, layer_1_backprop_angle_vals, c='b') plt.plot(layer_1_backprop_angle_iters, smoothed_layer_1_backprop_angle_vals, c='r') plt.plot(layer_1_backprop_angle_iters, [90 for a in layer_2_backprop_angle_iters], c='#bf5c00', linestyle='--') plt.xlabel('Iterations') plt.ylabel('$\\angle (\delta_{BP}, \delta_{DEN})$', size=12) plt.savefig('figure20-l.pdf', bbox_inches='tight') plt.figure() plt.xlim((0, layer_2_backprop_angle_iters[-1])) plt.ylim((0, 100)) plt.plot(layer_2_backprop_angle_iters, layer_2_backprop_angle_vals, c='b') plt.plot(layer_2_backprop_angle_iters, smoothed_layer_2_backprop_angle_vals, c='r') plt.xlabel('Iterations') plt.ylabel('$\\angle (\delta_{BP}, \delta_{DEN})$', size=12) plt.savefig('figure20-r.pdf', bbox_inches='tight') plt.show()