Execute this script by something like "python3 .\autodiff_test.py.py 1000"
This example python learns two models: model1 and model2. In this example, the training data is created in a way where model2 should outperform model1.
model1: prediction = a*x + b where a and b are the parameters
model2: perdiction = a*log(x) + b where and b are the paremters
The problem setting is the same as https://dse-souken.com/2021/05/18/ai-17/.
Execute this script by something like "python3 .\pytorch_rl_sample.py 2000 100"
This examples learns Two models: Normal Q Table and my own mathemtical model via Auto diff.
model1: normal Q table where state = place in maze and actions = {"up", "down", "right", "left"}. our Q table is different from https://dse-souken.com/2021/05/18/ai-17/.
model2: Q(state, action) = Σi,j state_{value of sate}{value of action} * (state == i) * (action == i)
Once model2 learned, each model parameters represent Q value, e.g. state_00 represents Q value for sate = 0 and action = 0(i.e. goes up from a place=0(state=0))
This script dumps learned results.