Skip to content

Problems running the examples #129

@phiyodr

Description

@phiyodr

Hi,

cool project! I tried to run the examples but I run into errors.

I think that might be due to different package versions I use (mainly pandas and six). Would you be so kind and provide me with the version numbers you used back then.

Error in movielens_preprocess:

----> 1 movie = movie_preprocessing(movie)

<ipython-input-7-0d79f909437b> in movie_preprocessing(movie)
     21     tag_table = {token: idx for idx, token in enumerate(set(itertools.chain.from_iterable(movie_tag)))}
     22     movie_tag = pd.DataFrame(movie_tag)
---> 23     tag_table = pd.DataFrame(tag_table.items())

~/Environments/py3old/lib/python3.6/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy)
    300                                          copy=False)
    301             else:
--> 302                 raise PandasError('DataFrame constructor not properly called!')
    303 
    304         NDFrame.__init__(self, mgr, fastpath=True)

PandasError: DataFrame constructor not properly called!

I could solve that replacing

tag_table = pd.DataFrame(tag_table.items())

with

tag_table=pd.DataFrame.from_dict(tag_table, orient='index')
tag_table.reset_index(level=0, inplace=True)

Error in movielens_bandit:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-263240bbee7e> in <module>()
----> 1 main()

<ipython-input-8-745ae3df14c6> in main()
    143     i = 0
    144     for bandit in experiment_bandit:
--> 145         policy = policy_generation(bandit, actions)
    146         seq_error = policy_evaluation(policy, bandit, streaming_batch_small, user_feature, reward_list,
    147                                       actions, action_context)

<ipython-input-8-745ae3df14c6> in policy_generation(bandit, actions)
     41 
     42     elif bandit == 'LinUCB':
---> 43         policy = linucb.LinUCB(actions, historystorage, modelstorage, 0.3, 20)
     44 
     45     elif bandit == 'LinThompSamp':

~/Environments/py3old/lib/python3.6/site-packages/striatum/bandit/linucb.py in __init__(self, history_storage, model_storage, action_storage, recommendation_cls, context_dimension, alpha)
     69             'theta': {},
     70         }
---> 71         for action_id in self._action_storage.iterids():
     72             self._init_action_model(model, action_id)
     73 

AttributeError: 'MemoryModelStorage' object has no attribute 'iterids'

Many thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions