Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
baselines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flatland
baselines
Commits
ba5ea65f
Commit
ba5ea65f
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.aicrowd.com:flatland/baselines
parents
5802f6dc
fea7ded7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/observation_utils.py
+7
-3
7 additions, 3 deletions
utils/observation_utils.py
with
7 additions
and
3 deletions
utils/observation_utils.py
+
7
−
3
View file @
ba5ea65f
...
@@ -31,7 +31,7 @@ def min_lt(seq, val):
...
@@ -31,7 +31,7 @@ def min_lt(seq, val):
return
min
return
min
def
norm_obs_clip
(
obs
,
clip_min
=-
1
,
clip_max
=
1
):
def
norm_obs_clip
(
obs
,
clip_min
=-
1
,
clip_max
=
1
,
fixed_radius
=
0
):
"""
"""
This function returns the difference between min and max value of an observation
This function returns the difference between min and max value of an observation
:param obs: Observation that should be normalized
:param obs: Observation that should be normalized
...
@@ -39,8 +39,12 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1):
...
@@ -39,8 +39,12 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1):
:param clip_max: max value where observation will be clipped
:param clip_max: max value where observation will be clipped
:return: returnes normalized and clipped observatoin
:return: returnes normalized and clipped observatoin
"""
"""
max_obs
=
max
(
1
,
max_lt
(
obs
,
1000
))
if
fixed_radius
>
0
:
min_obs
=
min
(
max_obs
,
min_lt
(
obs
,
0
))
max_obs
=
fixed_radius
else
:
max_obs
=
max
(
1
,
max_lt
(
obs
,
1000
))
+
1
min_obs
=
0
# min(max_obs, min_lt(obs, 0))
if
max_obs
==
min_obs
:
if
max_obs
==
min_obs
:
return
np
.
clip
(
np
.
array
(
obs
)
/
max_obs
,
clip_min
,
clip_max
)
return
np
.
clip
(
np
.
array
(
obs
)
/
max_obs
,
clip_min
,
clip_max
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment