Skip to content

Commit 088b0c0

Browse files
yuvaltassacopybara-github
authored andcommitted
Adding reciprocal function to rewards.tolerance.
PiperOrigin-RevId: 307403915 Change-Id: I006691b2ad397fb6e21b8d9f98d7b60e1855c4e4
1 parent 785e06d commit 088b0c0

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

dm_control/utils/rewards.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def _sigmoids(x, value_at_1, sigmoid):
6262
scale = np.sqrt(1/value_at_1 - 1)
6363
return 1 / ((x*scale)**2 + 1)
6464

65+
elif sigmoid == 'reciprocal':
66+
scale = 1/value_at_1 - 1
67+
return 1 / (abs(x)*scale + 1)
68+
6569
elif sigmoid == 'cosine':
6670
scale = np.arccos(2*value_at_1 - 1) / np.pi
6771
scaled_x = x*scale

dm_control/utils/rewards_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_tolerance_sigmoid_parameterisation(self, margin, value_at_margin):
4545

4646
@parameterized.parameters(("gaussian",), ("hyperbolic",), ("long_tail",),
4747
("cosine",), ("tanh_squared",), ("linear",),
48-
("quadratic"))
48+
("quadratic",), ("reciprocal",))
4949
def test_tolerance_sigmoids(self, sigmoid):
5050
margins = [0.01, 1.0, 100, 10000]
5151
values_at_margin = [0.1, 0.5, 0.9]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def find_data_files(package_dir, patterns):
166166

167167
setup(
168168
name='dm_control',
169-
version='0.0.307384858',
169+
version='0.0.307403915',
170170
description='Continuous control environments and MuJoCo Python bindings.',
171171
author='DeepMind',
172172
license='Apache License, Version 2.0',

0 commit comments

Comments
 (0)