def print_longterm_activity(): path = os.path.join( SG_SIM_PATH, "isgt-env-replace-3-of-7", "output_esn_run_0_bc-data_no_clean.txt") genome = best_genes_esn(path) options = load_prediction.get_options() options.num_predictions = 1 * 24 options.bc_data = True mc = load_prediction_esn.ESNModelCreator() model = mc.get_model(options) model.dataset = mc.get_dataset(options) model.cleaning_disabled = True model.train_and_predict_func = _esn_feedback_with_hook model.day = options.num_predictions (target, predictions) = test_genome_store_states(genome, model) plt.figure() plot_target_predictions(target, predictions) plt.figure() for act in activities: plt.plot(act) plt.axvline(x=1342) plt.show()
import ipdb import numpy as np import Oger, mdp import matplotlib.pyplot as plt import matplotlib import matplotlib.gridspec as gridspec import pandas as pd import sg.models.esn as esn import sg.utils from sg.data.sintef.create_full_temp_data import data as read_temperatures import sg.data.sintef.userloads as ul import sg.data.bchydro as bc import sg.models.load_prediction as load_prediction options = load_prediction.get_options() dataset = load_prediction.BCHydroDataset(options, dt(hours=672)) # [len_data, res_size, leak, input, bias, spectral, # seed, ridge, tmp_sm, load_sm] genome = [672, 194, 0.9507914597451542, 0.23017393420143673, 0.18145624723908402, 1.1091372652108626, 53380, 1.4880952380952382e-07] l = sg.utils.Enum('hindsight', 'size', 'leak', 'in_scale', 'bias_scale', 'spectral', 'seed', 'ridge')#, #'t_smooth', 'l_smooth', 't_zscore', 'l_zscore') # A bit of work is needed to normalize an array that contains NaNs. prediction_steps = 24 train_iter = dataset.train_data_iterator() test_iter = dataset.test_data_iterator()