takuti / flurs

:ocean: FluRS: A Python library for streaming recommendation algorithms
https://flurs.readthedocs.io/
MIT License
108 stars 17 forks source link

error running movielens1m.py #6

Closed Sandy4321 closed 6 years ago

Sandy4321 commented 6 years ago

I have installed flurs from pip and try to tun movielens1m.py

it is the error message File "d:\Recommender systems\code\flurs_master_FEb20\flurs-master\examples\movielens1m.py", line 4, in from flurs.datasets import fetch_movielens

builtins.ModuleNotFoundError: No module named 'flurs.datasets'

my guess it tries to use function fetch_movielens(data_home=None, size='100k') from https://github.com/takuti/flurs/blob/master/flurs/datasets/movielens.py

takuti commented 6 years ago

Did you directly install from source? flurs.datasets is not released to PyPI, so you should clone this repo and hit pip install . at the root of flurs directly to run the example.

Sandy4321 commented 6 years ago

great thanks for soon answer but I already installed from pip, so what will be with this installation? maybe some contradictions?

Sandy4321 commented 6 years ago

ok I reinstalled this as you wrote Microsoft Windows [Version 10.0.16299.248] (c) 2017 Microsoft Corporation. All rights reserved.

D:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master>pip install . Processing d:\recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master Requirement already satisfied (use --upgrade to upgrade): flurs==0.0.2 from file:///D:/Recommender%20systems/code/flurs_feb21_for_installation/flurs-master/flurs-master in c:\users\sander\anaconda3\lib\site-packages Requirement already satisfied: numpy in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already satisfied: scipy in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already satisfied: scikit_learn in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already satisfied: mmh3 in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Building wheels for collected packages: flurs Running setup.py bdist_wheel for flurs ... done Stored in directory: C:\Users\Sander\AppData\Local\pip\Cache\wheels\e3\22\aa\87668f0da413527d489b49c21a369d1e28d91bfd7a22741256 Successfully built flurs

D:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master>

but still there is error File "d:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master\examples\movielens1m.py", line 4, in from flurs.datasets import fetch_movielens

builtins.ModuleNotFoundError: No module named 'flurs.datasets'

maybe I need to do something what is written on the top of this file? """USAGE: %(program)s PATH_TO_MOVIELENS_1M_DIR """

but what is it? Thanks a lot for help !!!! It is really great code and I really keen to try it..

Sandy4321 commented 6 years ago

by the way if change order of imports , like this """USAGE: %(program)s PATH_TO_MOVIELENS_1M_DIR """

movielens1m_changed

from flurs.recommender import FMRecommender from flurs.datasets import fetch_movielens

from flurs.evaluator import Evaluator

import logging import os import sys

then I have still error File "d:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master\examples\movielens1m_changed.py", line 5, in from flurs.recommender import FMRecommender

builtins.ImportError: cannot import name 'FMRecommender'

takuti commented 6 years ago

You should focus on the following message:

Processing d:\recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master
Requirement already satisfied (use --upgrade to upgrade): flurs==0.0.2 from file:///D:/Recommender%20systems/code/flurs_feb21_for_installation/flurs-master/flurs-master in c:\users\sander\anaconda3\lib\site-packages

Your environment already has FluRS 0.0.2 from PyPI, so, in order to replace the package with the latest one, you need to put --upgrade option: pip install . --upgrade

Then, I hope that the following command with your own MovieLens 1M path works:

$ python movielens1m.py /path/to/ml-1m
Sandy4321 commented 6 years ago

great thanks for help I run installation as you recommend but new version is the same as old flurs-0.0.2 Microsoft Windows [Version 10.0.16299.248] (c) 2017 Microsoft Corporation. All rights reserved.

D:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master>pip install . --upgrade Processing d:\recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master Requirement already up-to-date: numpy in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already up-to-date: scipy in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already up-to-date: scikit_learn in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Requirement already up-to-date: mmh3 in c:\users\sander\anaconda3\lib\site-packages (from flurs==0.0.2) Building wheels for collected packages: flurs Running setup.py bdist_wheel for flurs ... done Stored in directory: C:\Users\Sander\AppData\Local\pip\Cache\wheels\e3\22\aa\87668f0da413527d489b49c21a369d1e28d91bfd7a22741256 Successfully built flurs Installing collected packages: flurs Found existing installation: flurs 0.0.2 Uninstalling flurs-0.0.2: Successfully uninstalled flurs-0.0.2 Successfully installed flurs-0.0.2

D:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master>

Sandy4321 commented 6 years ago

ok so I run this code for this data https://grouplens.org/datasets/movielens/1m/ and see this 2018-02-22 10:16:36,892 : INFO : running d:\Recommender systems\code\flurs_feb21_for_installation\flurs-master\flurs-master\examples\movielens1m_changed.py .\ml-1m 2018-02-22 10:16:36,893 : INFO : converting data into FluRS input object 2018-02-22 10:17:08,978 : INFO : initialize recommendation model and evaluation module 2018-02-22 10:17:08,979 : INFO : batch pre-training before streaming input 2018-02-22 10:21:07,093 : INFO : incrementally predict, evaluate and update the recommender <generator object Evaluator.evaluate at 0x000001FEBB0200A0> is it correct? how to check is result as expected?

takuti commented 6 years ago

Not same; your package has been successfully upgraded, while the version is still indicates the old one 0.0.2.

movielens1m.py finally returns a Python generator yielded at https://github.com/takuti/flurs/blob/master/flurs/evaluator.py#L105-L106. You can access to the result e.g., list(res) or so.

Sandy4321 commented 6 years ago

GREAT THANKS A LOT