Full Deep Reinforcement Example
All that's left to do is bring together everything from the previous sections!
from hula.DeepR import Net, FeedForwardLayer
from hula.rlutils import sigmoid, softplus, tanh
ExampleNet = Net(
FeedForwardLayer(2, 16, tanh),
FeedForwardLayer(16, 6, softplus),
FeedForwardLayer(6, 1, sigmoid)
)
for epoch in range(1000):
ExampleNet.randomAct(0.001)
error = ExampleNet.activate([1, 1])[0]
ExampleNet.score(error)
ExampleNet.train(0.8)
if epoch % 50 == 0:
ExampleNet.simplify(2, 0.5)
print(epoch, error)
The Network will be trained to approach 1.0
for 1000
epochs.
Last updated
Was this helpful?