Closed tobiasmorville closed 4 years ago
cc: @threewisemonkeys-as
@tomonodes Could you update your installation (from source) and try this:
from genrl.utils import StatlogDataBandit
bandit = StatlogDataBandit(download=True)
context = bandit.reset()
from genrl.agents import NeuralLinearPosteriorAgent
agent = NeuralLinearPosteriorAgent(bandit)
context = bandit.reset()
action = agent.select_action(context)
new_context, reward = bandit.step(action)
from genrl.trainers import DCBTrainer
trainer = DCBTrainer(agent, bandit)
trainer.train(timesteps=5000, batch_size=32)
This works for me.
Feel free to close the issue(if this works).
Yep, this looks like an older build. This specific issue was fixed in #260 . The docs still seem to be outdated though. This should be fixed with #281
Installing with pip install genrl
installs genrl==0.0.2
which reproduces the bug on a clean conda env with python 3.6.
Building from source installs genrl==0.0.1
in which the above problem is solved 👍.
Running the StatLog shuttle example
yields an error in the training:
Printing the output at the time of transition
self.db[contexts]
is a list of strings:Full error trace:
EDIT:
Printing
idx
at the time of error yields:and fetching correspondant contexts from the agent
[agent.db.db['contexts'][x] for x in idx]
yields seemingly valid input:however, printing
self.db[contexts]
yields all strings: