Exemplo n.º 1
0
data = load_data.get_data()
input_data = data['input']
output_data = data['output']

train_in = input_data[train_idx]
train_out_truth = output_data[train_idx]
test_in = input_data[test_idx]
test_out_truth = output_data[test_idx]

#make our network and run dat dynamical boi

esn = pyESN.ESN(n_inputs=train_in.shape[1],
                n_outputs=train_out_truth.shape[1],
                n_reservoir=700,
                spectral_radius=.8,
                noise=.08,
                silent=False,
                sparsity=.92,
                random_state=42)

print("training network...")
machine_training_out = esn.fit(train_in, train_out_truth, inspect=False)
print("done training network.")

for pred_col in range(1):  #train_out_truth.shape[1] ) :

    plt.title("training results for col " + str(pred_col))
    plt.plot(machine_training_out[:, pred_col], label="machine pred")
    plt.plot(train_out_truth[:, pred_col], label="truth")
    plt.legend(loc='best')
    plt.show()
Exemplo n.º 2
0
data = load_data.get_data()
move_data = data['move_data'][:, 0:1]
neuron_data = data['neuron_data']

train_in = neuron_data[train_idx]
train_out_truth = move_data[train_idx]
test_in = neuron_data[test_idx]
test_out_truth = move_data[test_idx]

#make our network and run dat dynamical boi

esn = pyESN.ESN(n_inputs=train_in.shape[1],
                n_outputs=train_out_truth.shape[1],
                n_reservoir=1000,
                spectral_radius=.3,
                teacher_forcing=False,
                noise=.001,
                sparsity=.42,
                random_state=42)

print("training network...")
machine_training_out = esn.fit(train_in, train_out_truth, inspect=False)
print("done training network.")

plt.title("training results")
plt.plot(machine_training_out[:, 0], label="machine pred")
plt.plot(train_out_truth[:, 0], label="truth")
plt.legend(loc='best')
plt.show()

#compute our err on trained output (should be small)