MicroMLP icon indicating copy to clipboard operation
MicroMLP copied to clipboard

Example request for QLearning

Open Feiko opened this issue 5 years ago • 2 comments

Could you please add an example on how to train and implement QLearning? I find this a very interesting feature.

Feiko avatar Jul 03 '19 19:07 Feiko

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.

jczic avatar Jul 04 '19 22:07 jczic

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.

jrmoserbaltimore avatar Mar 26 '21 17:03 jrmoserbaltimore