752f17f65ff851521b00f699e32f45e14945f069,tests/algorithms/test_td.py,,test_q_learning,#,19
Before Change
pi, mdp, _ = initialize()
alg = QLearning(pi, mdp.info, Parameter(.5))
alg.Q.table = np.arange(np.prod(mdp.info.size)).reshape(mdp.info.size)
alg._update(0, 1, 100, 1, 0)
alg._update(1, 0, 10, 3, 1)
alg._update(3, 1, 50, 3, 0)
alg._update(2, 2, -100, 3, 1)
test_q = np.array([[0, 53, 2, 3],
[7, 5, 6, 7],
[8, 9, -45, 11],
[12, 38, 14, 15]])
assert np.array_equal(alg.Q.table, test_q)
After Change
// Train
core.learn(n_steps=100, n_steps_per_fit=1, quiet=True)
test_q = np.array([[7.82042542, 8.40151978, 7.64961548, 8.82421875],
[8.77587891, 9.921875, 7.29316406, 8.68359375],
[7.7203125, 7.69921875, 4.5, 9.84375],
[0., 0., 0., 0.]])
assert np.allclose(agent.Q.table, test_q)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 25
Instances
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 752f17f65ff851521b00f699e32f45e14945f069
Time: 2019-11-12
Author: carlo.deramo@gmail.com
File Name: tests/algorithms/test_td.py
Class Name:
Method Name: test_q_learning
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 752f17f65ff851521b00f699e32f45e14945f069
Time: 2019-11-12
Author: carlo.deramo@gmail.com
File Name: tests/algorithms/test_td.py
Class Name:
Method Name: test_sarsa
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 752f17f65ff851521b00f699e32f45e14945f069
Time: 2019-11-12
Author: carlo.deramo@gmail.com
File Name: tests/algorithms/test_td.py
Class Name:
Method Name: test_expected_sarsa
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 752f17f65ff851521b00f699e32f45e14945f069
Time: 2019-11-12
Author: carlo.deramo@gmail.com
File Name: tests/algorithms/test_td.py
Class Name:
Method Name: test_q_learning
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 752f17f65ff851521b00f699e32f45e14945f069
Time: 2019-11-12
Author: carlo.deramo@gmail.com
File Name: tests/algorithms/test_td.py
Class Name:
Method Name: test_weighted_q_learning