results_plotter error: "tuple indices must be integers or slices, not str"
See original GitHub issueHi there!
I tried to use the results_plotter.py code to plot my results of training, however when I run it either on jupyter or on terminal it gives me the following error massege (this is on jupyter-notebook):
-----------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-3f0abc02953f> in <module>()
----> 1 plot_results("~/logs/cartpole-ppo-log")
~/MachineLearning/DRL/OpenAI/baselines/0.Mine/baselines/results_plotter.py in plot_results(dirs, num_timesteps, xaxis, yaxis, title, split_fn)
69 def plot_results(dirs, num_timesteps=10e6, xaxis=X_TIMESTEPS, yaxis=Y_REWARD, title='', split_fn=split_by_task):
70 results = plot_util.load_results(dirs)
---> 71 plot_util.plot_results(results, xy_fn=lambda r: ts2xy(r['monitor'], xaxis, yaxis), split_fn=split_fn, average_group=True, resample=int(1e6))
72
73 # Example usage in jupyter-notebook
~/MachineLearning/DRL/OpenAI/baselines/0.Mine/baselines/common/plot_util.py in plot_results(allresults, xy_fn, split_fn, group_fn, average_group, shaded_std, shaded_err, figsize, legend_outside, resample, smooth_step)
297 sk2r = defaultdict(list) # splitkey2results
298 for result in allresults:
--> 299 splitkey = split_fn(result)
300 sk2r[splitkey].append(result)
301 assert len(sk2r) > 0
~/MachineLearning/DRL/OpenAI/baselines/0.Mine/baselines/results_plotter.py in split_by_task(taskpath)
65
66 def split_by_task(taskpath):
---> 67 return taskpath['dirname'].split('/')[-1].split('-')[0]
68
69 def plot_results(dirs, num_timesteps=10e6, xaxis=X_TIMESTEPS, yaxis=Y_REWARD, title='', split_fn=split_by_task):
TypeError: tuple indices must be integers or slices, not str
What is the problem?!
Best regards.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
TypeError: tuple indices must be integers or slices, not str
The Python TypeError: tuple indices must be integers or slices, not str occurs when we use a string instead of an integer to...
Read more >Python Error: tuple indices must be integers or slices, not str
When I am running I run into an error that says tuple indices must be integers or slices, not str. When I print...
Read more >TypeError: tuple indices must be integers, not str - Codecademy
TypeError: tuple indices must be integers, not str ... they are considered tuples, tuples are like lists except immutable (can't be changed once...
Read more >TypeError: tuple indices must be integers or slices, not str ...
python tutorial: #codefix #python #python_tutorialsTypeError: tuple indices must be integers or slices, not str : In this video i have shared ...
Read more >TypeError: tuple indices must be integers or slices, not str ...
The typeerror: tuple indices must be integers or slices, not str error comes when you can't get row information using row["pool_number"].
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I get the same problem because the taskpath is not a dict, using the follow codes to fix this:
It’s the same in plot_results function:
xy_fn=lambda r: ts2xy(r.monitor, xaxis, yaxis)
same problem, request a perfect solution