MicroMLP
MicroMLP copied to clipboard
Example request for QLearning
Could you please add an example on how to train and implement QLearning? I find this a very interesting feature.
Hello, I don't have an example now but you must use the "QLearningLearnForChosenAction" function to learn a new step in the current environment for an action performed. "stateVectorNNValues" is the values of the environment now and "pastStateVectorNNValues", the values of the environment before the action. The network must have as many output neurons as possible actions and "chosenActionIndex" is the index of the output action neuron selected. You can check https://en.wikipedia.org/wiki/Q-learning to fast understand the logic of QLearning.
Is this suitable for reducing error on input vectors? e.g. if I have 4 (3 state, 1 error) inputs and 3 outputs, and from the outputs I take an action that then causes the error to increase or decrease, can I pass back to it the new error state or the change in error state and have it learn that what it did made things better/worse?
I'm trying to do this with a loop with xor.py
:
- Predict for random pair of booleans
- Compute the XOR of those two booleans
- Tell it that in prior state it predicted correctly/incorrectly
But more I'm interested in auto-tuning, i.e. you have a sensor input X, adjust the PWM to a heater and then come back and determine if the error increased or decreased.