0

I'm trying to use that Object as This Blog uses in His Code but when I do from rl.agents.dqn import DQfDAgent it returns me and error ImportError: cannot import name 'DQfDAgent'.

I've done a dir(rl.agents.dqn) and there is no DQfDAgent object so, how has the man of the blog done it?

(Update 1)

I've already done this:

pip install -e git+git://github.com/jakegrigsby/keras-rl.git#egg=keras-rl

but it returns this error:

Command "git clone -q git://github.com/jakegrigsby/keras-rl.git C:\Users\myuser\src\keras-rl" failed with error code 128 in None
Angelo
  • 575
  • 3
  • 18

2 Answers2

2

note that the master version of keras-rl may be missing my additions. See my fork.

Just do a quick search for DQfDAgent and you ll see that it is not in the rl.agents.dqn source code page. Use the branch of the author (here) to import properly and use the agent he has implemented but which is not in the official version.

Frayal
  • 2,117
  • 11
  • 17
  • Ouch, my fault. Thanks for the explanation. – Angelo Mar 12 '19 at 11:59
  • Np. I missed it too at first . Always happy to help! – Frayal Mar 12 '19 at 12:46
  • How can I use this version of keras-rl instead of the one I'm using now? I tried to run the setup.py script and I can't figure out how to do it. – Angelo Mar 13 '19 at 08:57
  • i honestly don't know... I will try to look into it and update the answer. but look at this (https://stackoverflow.com/questions/30292039/pip-install-forked-github-repo) @Angelo – Frayal Mar 13 '19 at 09:06
  • i suggests that you open a new question because i am not qualified enough in this domain to help you. Plus with an accepted answer less people will see the new issue. – Frayal Mar 13 '19 at 13:07
1

The README.md file of the repo you linked indicates that:

Note that the master version of keras-rl may be missing my additions. See my fork.

In such a fork, you can find an implementation of DQfDAgent in the following code: https://github.com/jakegrigsby/keras-rl/blob/master/rl/agents/dqn.py

Pablo EM
  • 6,190
  • 3
  • 29
  • 37
  • Hi Angelo! You probably will get a better response for you new update opening a new question, since this question already has an accepted response. BTW, don't forget voting up any answer which you found useful. – Pablo EM Mar 13 '19 at 13:09