n_neurons = 100
ac = AdaptiveControl(n_inputs=1, n_outputs=1, n_neurons=n_neurons, seed=1)

inputs = np.linspace(-1, 1, 100)
rates = np.zeros((len(inputs), n_neurons))
for i, input in enumerate(inputs):
    current = ac.compute_neuron_input([input])
    activity = ac.neuron(current)
    rates[i, :] = activity
pylab.plot(inputs, rates);

"""
Explanation: Let's quickly examine what sorts of activity values the neurons give for different inputs.
End of explanation
"""


n_neurons = 100
ac = AdaptiveControl(n_inputs=1, n_outputs=1, n_neurons=n_neurons, seed=1, learning_rate=1e-3)

inputs = []
outputs = []
errors = []
error = np.zeros(1)
for i in range(2000):
    input = np.sin(i*2*np.pi/1000)
    output = ac.step([input], error)
    error[:] = output - input
    inputs.append(input)
    outputs.append(output)
    errors.append(output-input)
    
    
    

pylab.plot(inputs, label='input')
pylab.plot(outputs, label='output')
pylab.plot(errors, label='error')
pylab.legend(loc='best')
pylab.show()

"""
Explanation: Now let's try teaching the model to just output the identity function (i.e. the output should be the same as the input).  We train it over a sine wave.
End of explanation
"""


