MAMEToolkit icon indicating copy to clipboard operation
MAMEToolkit copied to clipboard

How to you see the learning data that is graphed in the Readme?

Open rhickstedjr opened this issue 7 years ago • 6 comments

Simple ConvNet Agent: How to you see the ML data that is graphed in the Readme?

Once I hit escape key I do not see any data?

I expect to see reward vs games.

Thanks,

Rick

rhickstedjr avatar Feb 12 '19 17:02 rhickstedjr

script:

#!/usr/bin/env python3

import random from MAMEToolkit.sf_environment import Environment

roms_path = "roms/" # Replace this with the path to your ROMs env = Environment("env1", roms_path) env.start() #while True: move_action = random.randint(0, 8) attack_action = random.randint(0, 9) frames, reward, round_done, stage_done, game_done = env.step(move_action, attack_action) if game_done: env.new_game() elif stage_done: env.next_stage() elif round_done: env.next_round()

If I just hit escape I see:

parallels@parallels-Parallels-Virtual-Platform:~$ python3.6 ./sf.py Failed to read value from 'dataPipe' Traceback (most recent call last): File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/emulator/pipes/Pipe.py", line 96, in readln return self.read_queue.get(timeout=timeout) File "/usr/lib/python3.6/queue.py", line 172, in get raise Empty queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./sf.py", line 13, in frames, reward, round_done, stage_done, game_done = env.step(move_action, attack_action) File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/sf_environment/Environment.py", line 211, in step data = self.gather_frames(actions) File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/sf_environment/Environment.py", line 179, in gather_frames data = self.sub_step(actions) File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/sf_environment/Environment.py", line 190, in sub_step data = self.emu.step([action.value for action in actions]) File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/emulator/Emulator.py", line 150, in step data = self.dataPipe.read_data(timeout=10) # gathers the frame data and memory address values File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/emulator/pipes/DataPipe.py", line 27, in read_data line = self.pipe.readln(timeout=timeout) File "/home/parallels/.local/lib/python3.6/site-packages/MAMEToolkit/emulator/pipes/Pipe.py", line 100, in readln raise IOError(error) OSError: Failed to read value from 'dataPipe' parallels@parallels-Parallels-Virtual-Platform:~$

rhickstedjr avatar Feb 12 '19 18:02 rhickstedjr

The toolkit does not automatically create the graph. If you want to build this graph you will need to take the sum or rewards for every episode. Then you can use the Matplotlib library to build the graph. It's fairly simple to use. Best of luck!

M-J-Murray avatar Feb 12 '19 20:02 M-J-Murray

Where is the raw data stored for each episode?

rhickstedjr avatar Feb 12 '19 21:02 rhickstedjr

Also each time you start the emulator does the alg start from ground zero each time?

rhickstedjr avatar Feb 12 '19 21:02 rhickstedjr

The toolkit does not keep track of overall stats across an episode. You will need to store every reward returned from the step function over an entire episode yourself.

M-J-Murray avatar Feb 13 '19 08:02 M-J-Murray

Feature request?

rhickstedjr avatar Feb 13 '19 17:02 rhickstedjr