facebookresearch / Pearl

A Production-ready Reinforcement Learning AI Agent Library brought by the Applied Reinforcement Learning team at Meta.
MIT License
2.67k stars 165 forks source link

Bug in tutorial single item recommender system: can't instantiate abstract class RecEnv #87

Closed milmin closed 6 months ago

milmin commented 6 months ago

In the tutorial single_item_recommender_system.ipynb when calling RecEnv(list(actions.values())[:100], model, history_length) I get

TypeError: Can't instantiate abstract class RecEnv with abstract method observation_space
milmin commented 6 months ago

Since RecEnv inherits from class Environment which has abstract method observation_space a solution is to override it in RecEnv with something like:

def observation_space(self):
    pass

In this tutorial, having an empty observation space is that wanted?

rodrigodesalvobraz commented 6 months ago

Thank you for reporting. This should be fixed now.

rodrigodesalvobraz commented 6 months ago

Since RecEnv inherits from class Environment which has abstract method observation_space a solution is to override it in RecEnv with something like:

def observation_space(self):
    pass

In this tutorial, having an empty observation space is that wanted?

In this example, the observations are the obtained reward, which has a range from 0 to 1, so the observation space is a Box from 0 to 1. This has been included in our latest commit. Thank you.