Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esn = ESN(n_inputs = 1,
- n_outputs = 1,
- n_reservoir = 500,
- sparsity=0.2,
- random_state=23,
- spectral_radius=1.2,
- noise = 0.005)
- trainlen = 1500
- validation_set = []
- for i in range(0,100):
- pred_training = esn.fit(np.ones(trainlen),amazon[i:trainlen+i])
- prediction = esn.predict(np.ones(2))
- validation_set.append(prediction[0])
- def MSE(prediction, actual):
- return np.mean(np.power(np.subtract(np.array(prediction),actual),2))
- def run_echo(sr, n, window):
- esn = ESN(n_inputs = 1,
- n_outputs = 1,
- n_reservoir = 500,
- sparsity=0.2,
- random_state=23,
- spectral_radius=sr,
- noise = n)
- trainlen = 1500
- current_set = []
- for i in range(0,100):
- pred_training = esn.fit(np.ones(trainlen),amazon[i:trainlen+i])
- prediction = esn.predict(np.ones(window))
- current_set.append(prediction[0])
- current_set = np.reshape(np.array(current_set),(-1,100))
- mse = MSE(current_set, amazon[trainlen:trainlen+100])
- return (mse, current_set)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement