Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
causal_nie
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tuhe
causal_nie
Commits
e4b51f2f
Commit
e4b51f2f
authored
3 years ago
by
tuhe
Browse files
Options
Downloads
Patches
Plain Diff
Revision of dependencies + scripts (minor)
parent
bec12822
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
irlc/agent.py
+1
-22
1 addition, 22 deletions
irlc/agent.py
with
1 addition
and
22 deletions
irlc/agent.py
+
1
−
22
View file @
e4b51f2f
...
@@ -7,8 +7,7 @@ import os
...
@@ -7,8 +7,7 @@ import os
from
collections
import
OrderedDict
,
namedtuple
from
collections
import
OrderedDict
,
namedtuple
from
niebellman.utils.common
import
log_time_series
,
load_time_series
from
niebellman.utils.common
import
log_time_series
,
load_time_series
class
Agent
:
class
Agent
:
#!s #!s
"""
Main agent class. See
\n
ref{c1s43} for additional details.
"""
"""
Main agent class. See
\n
ref{c1s43} for additional details.
"""
def
__init__
(
self
,
env
):
#!s
def
__init__
(
self
,
env
):
#!s
self
.
env
=
env
#!s
self
.
env
=
env
#!s
...
@@ -120,23 +119,3 @@ def train(env, agent, experiment_name=None, num_episodes=1, verbose=True, reset=
...
@@ -120,23 +119,3 @@ def train(env, agent, experiment_name=None, num_episodes=1, verbose=True, reset=
log_time_series
(
experiment
=
experiment_name
,
list_obs
=
stats
)
log_time_series
(
experiment
=
experiment_name
,
list_obs
=
stats
)
print
(
f
"
Training completed. Logging
{
experiment_name
}
:
'
{
'
,
'
.
join
(
stats
[
0
].
keys
())
}
'"
)
print
(
f
"
Training completed. Logging
{
experiment_name
}
:
'
{
'
,
'
.
join
(
stats
[
0
].
keys
())
}
'"
)
return
stats
,
trajectories
return
stats
,
trajectories
# def load_time_series(experiment_name, exclude_empty=True):
# """
# Load most recent non-empty time series (we load non-empty since lazylog creates a new dir immediately)
# """
# files = list(filter(os.path.isdir, glob.glob(experiment_name+"/*")))
# if exclude_empty:
# files = [f for f in files if os.path.exists(os.path.join(f, "log.txt")) and os.stat(os.path.join(f, "log.txt")).st_size > 0]
#
# recent = sorted(files, key=lambda file: os.path.basename(file))[-1]
# stats = []
# with open(recent + '/log.txt', 'r') as f:
# csv_reader = csv.reader(f, delimiter='\t')
# for i, row in enumerate(csv_reader):
# if i == 0:
# head = row
# else:
# stats.append( {k:float(v) for k, v in zip(head, row) } )
# return stats, recent
\ No newline at end of file
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