Fix curiosity tanh bug

This commit is contained in:
Dominik Moritz Roth 2022-11-30 17:44:12 +01:00
parent 73c7e5e6c2
commit 2f2da60626

View File

@ -395,13 +395,15 @@ def removeUselessTags(G, minUnread=1):
G.remove_node(n)
def curiosityReward(G, coeff=1, dTan=True):
def curiosityReward(G, coeff=1, dTan=False):
for n in list(G.nodes):
node = G.nodes[n]
if 'score' in node and 'se' in node:
delta = node['se'] * coeff
if dTan:
delta *= (1- math.tanh((node['score']/10-0.5)*7)**2)
delta *= (1 - math.tanh((node['score']/10-0.5)*7)**2)
else:
delta *= (1 - math.tanh(node['score']/5))
new = max(0.0, min(10.0, node['score'] + delta))
node['score'] = new