google-research / recsim_ng

RecSim NG: Toward Principled Uncertainty Modeling for Recommender Ecosystems
https://github.com/google-research/recsim_ng
Apache License 2.0
115 stars 16 forks source link

module 'recsim_ng.core.value' has no attribute 'Space' #1

Open aSeriousCoder opened 2 years ago

aSeriousCoder commented 2 years ago

Hi, I'm following your tutorials, but encounter with one trouble...

In "The User Model" part of second tutorial (RecSim_NG_Dealing_With_Uncertainty.ipynb), we need to do some imports, as belows:

from recsim_ng.stories import recommendation_simulation as simulation
from recsim_ng.applications.latent_variable_model_learning import recommender
from recsim_ng.entities.recommendation import user
from recsim_ng.entities.state_models import static
from recsim_ng.entities.choice_models import selectors
from recsim_ng.entities.choice_models import affinities

But the second import throw an error as belows:

AttributeError                            Traceback (most recent call last)
<ipython-input-5-d9a555230cf0> in <module>
      1 # @title RecSimNG modeling imports.
      2 from recsim_ng.stories import recommendation_simulation as simulation
----> 3 from recsim_ng.applications.latent_variable_model_learning import recommender
      4 from recsim_ng.entities.recommendation import user
      5 from recsim_ng.entities.state_models import static

/usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/__init__.py in <module>
     15 
     16 """Module importing the application learning latent variable models."""
---> 17 from recsim_ng.applications.latent_variable_model_learning import recommender
     18 from recsim_ng.applications.latent_variable_model_learning import simulation_config
     19 from recsim_ng.applications.latent_variable_model_learning import user

/usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/recommender.py in <module>
     27 Value = value.Value
     28 ValueSpec = value.ValueSpec
---> 29 Space = value.Space
     30 
     31 

AttributeError: module 'recsim_ng.core.value' has no attribute 'Space'

And I checked the source code then and indeed, I can't find "Space" Class in recsim_ng.core.value

Looking forward to your kindly help.

cwhsu-google commented 2 years ago

Hi,

Thanks for using RecSim NG. As we can see the Space class was moved to field_spec.py already: https://github.com/google-research/recsim_ng/blob/master/recsim_ng/applications/latent_variable_model_learning/recommender.py#L31 At some point there was a discrepancy between GitHub and PIP package so please upgrade RecSim NG properly to fix this problem.

On Sun, Nov 28, 2021 at 5:08 AM GuangpingZhang @.***> wrote:

Hi, I'm following your tutorials, but encounter with one trouble...

In "The User Model" part of second tutorial (RecSim_NG_Dealing_With_Uncertainty.ipynb), we need to do some imports, as belows:

from recsim_ng.stories import recommendation_simulation as simulation from recsim_ng.applications.latent_variable_model_learning import recommender from recsim_ng.entities.recommendation import user from recsim_ng.entities.state_models import static from recsim_ng.entities.choice_models import selectors from recsim_ng.entities.choice_models import affinities

But the second import throw an error as belows:

AttributeError Traceback (most recent call last)

in 1 # @title RecSimNG modeling imports. 2 from recsim_ng.stories import recommendation_simulation as simulation ----> 3 from recsim_ng.applications.latent_variable_model_learning import recommender 4 from recsim_ng.entities.recommendation import user 5 from recsim_ng.entities.state_models import static /usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/__init__.py in 15 16 """Module importing the application learning latent variable models.""" ---> 17 from recsim_ng.applications.latent_variable_model_learning import recommender 18 from recsim_ng.applications.latent_variable_model_learning import simulation_config 19 from recsim_ng.applications.latent_variable_model_learning import user /usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/recommender.py in 27 Value = value.Value 28 ValueSpec = value.ValueSpec ---> 29 Space = value.Space 30 31 AttributeError: module 'recsim_ng.core.value' has no attribute 'Space' And I checked the source code then and indeed, I can't find "Space" Class in recsim_ng.core.value Looking forward to your kindly help. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or unsubscribe . Triage notifications on the go with GitHub Mobile for iOS or Android .
aSeriousCoder commented 2 years ago

Thanks for your detailed response! I have fixed this according to your instructions.

Hope a new version of recsim_ng could land on PIP soon.

: )

ehtsham commented 2 years ago

Still finding the same error, what do you mean by "upgrade RecSim NG properly"

soonjune commented 2 years ago

try installing recsim_ng using pip install .