1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-12 23:36:54 +08:00
This commit is contained in:
Yuchen Fang
2021-01-28 00:41:02 +08:00
parent 98086e4fdc
commit a03b08bb4c
21 changed files with 154 additions and 563 deletions

View File

@@ -18,9 +18,7 @@ class VP_Penalty_small(Instant_Reward):
assert target > 0
reward = performance_raise * v_t / target
reward -= self.penalty * (v_t / target) ** 2
assert not (
np.isnan(reward) or np.isinf(reward)
), f"{performance_raise}, {v_t}, {target}"
assert not (np.isnan(reward) or np.isinf(reward)), f"{performance_raise}, {v_t}, {target}"
return reward / 100
@@ -35,7 +33,5 @@ class VP_Penalty_small_vec(VP_Penalty_small):
assert target > 0
reward = performance_raise * v_t.sum() / target
reward -= self.penalty * ((v_t / target) ** 2).sum()
assert not (
np.isnan(reward) or np.isinf(reward)
), f"{performance_raise}, {v_t}, {target}"
assert not (np.isnan(reward) or np.isinf(reward)), f"{performance_raise}, {v_t}, {target}"
return reward / 100