vae_cf icon indicating copy to clipboard operation
vae_cf copied to clipboard

One problem reveals when I rerun the program

Open tyhmas opened this issue 5 years ago • 6 comments

Hi Dawen,

I am writing to ask if you ever had the following error when you implemented your program, which is shown in the snapshot attached with this message. This error came out after I converted your Jupyter notebook file into a python file named old_code.py and tried to run it.

After filtering, there are 9990682 watching events from 136677 users and 20720 movies (sparsity: 0.353%) 0 users sampled 1000 users sampled 2000 users sampled 3000 users sampled 4000 users sampled 5000 users sampled 6000 users sampled 7000 users sampled 8000 users sampled 9000 users sampled 0 users sampled 1000 users sampled 2000 users sampled 3000 users sampled 4000 users sampled 5000 users sampled 6000 users sampled 7000 users sampled 8000 users sampled 9000 users sampled Traceback (most recent call last): File "old_code.py", line 250, in train_data = numerize(train_plays) File "old_code.py", line 244, in numerize return pd.DataFrame(data={'uid': uid, 'sid': sid}, columns=['uid', 'sid']) File "C:\Software\Anaconda\lib\site-packages\pandas\core\frame.py", line 348, in init mgr = self._init_dict(data, index, columns, dtype=dtype) File "C:\Software\Anaconda\lib\site-packages\pandas\core\frame.py", line 439, in _init_dict index = extract_index(arrays[~missing]) File "C:\Software\Anaconda\lib\site-packages\pandas\core\frame.py", line 7349, in extract_index raw_lengths.append(len(v)) TypeError: object of type 'map' has no len()

Apologize for such inconvenience and thank you for your attention meanwhile! :)

tyhmas avatar Jun 07 '19 22:06 tyhmas

I got a similar error because I was using Python 3 to execute the code.

To rectify it, I changed the numerize function to:

def numerize(tp):

    uid = [profile2id[x] for x in tp['userId']]

    sid = [show2id[x] for x in tp['movieId']]

    return pd.DataFrame(data={'uid': uid, 'sid': sid}, columns=['uid', 'sid'])

You can try using the above function and let me know if it works for you! All the best!

shrawansapre avatar Jun 07 '19 22:06 shrawansapre

I got a similar error because I was using Python 3 to execute the code.

To rectify it, I changed the numerize function to:

def numerize(tp):

    uid = [profile2id[x] for x in tp['userId']]

    sid = [show2id[x] for x in tp['movieId']]

    return pd.DataFrame(data={'uid': uid, 'sid': sid}, columns=['uid', 'sid'])

You can try using the above function and let me know if it works for you! All the best!

It works my problem fine, there are bugs for me to keep on going though. Thank you!

tyhmas avatar Jun 10 '19 18:06 tyhmas

There are many changes to make if you are using Python 3. All the best!

shrawansapre avatar Jun 10 '19 19:06 shrawansapre

@shrawansapre Do you have the python 3.5+ file for this repo. If so could you share that. I am struggling to make it work on python 3.5+.

Thanks

karthikraja95 avatar Jul 11 '19 14:07 karthikraja95

def numerize(tp): uid = map(lambda x: profile2id[x], tp['userId']) sid = map(lambda x: show2id[x], tp['movieId']) return pd.DataFrame(data={'uid': [uid], 'sid': [sid]}, columns=['uid', 'sid'])

Aldhubri avatar Jan 20 '20 12:01 Aldhubri

def numerize(tp): uid = map(lambda x: profile2id[x], tp['userId']) sid = map(lambda x: show2id[x], tp['movieId']) return pd.DataFrame(data={'uid': [uid], 'sid': [sid]}, columns=['uid', 'sid'])

This looks to give an error later on

LaurynasGiriunas avatar Apr 08 '20 07:04 LaurynasGiriunas