Comments (6)
Hi,
You don't need this code bit:
from recsys.utils.svdlibc import SVDLIBC
svdlibc = SVDLIBC('/usr/local/python-recsys-master/recsys/data/movielens/ratings.dat')
svdlibc.to_sparse_matrix(sep='::', format={'col':0, 'row':1, 'value':2, 'ids': int})
svdlibc.compute(k=100)
svd = svdlibc.export()
svd can be created using either divisi2 SVD (default), or by calling SVDLIBC, the external C library, that runs faster, and uses less memory.
Looking at your code, you're doing both things, and you only need to do one.
You can have a look here for (quick start example): http://ocelma.net/software/python-recsys/build/html/quickstart.html (step 8 is an alternative version of step 2).
I hope this helps!
from python-recsys.
thank you very much!another question...now i get the svd model and i save it to '/tmp/Svd_model'
how could i get the RMSE and MAE of this model?under the path /python-recsys-master/python-recsys-master/draft,there is a code named test_svd.py ,but everytime i run it ,there is no result in a long time....Is there alternate way to get the model's Evaluation?thanks a lot for you kindly reply!
from python-recsys.
Regarding your RMSE and MAE question, try this:
#Evaluation using prediction-based metrics
rmse = RMSE()
mae = MAE()
for rating, item_id, user_id in test.get():
try:
pred_rating = svd.predict(item_id, user_id)
rmse.add(rating, pred_rating)
mae.add(rating, pred_rating)
print 'RMSE=%s' % rmse.compute()
print 'MAE=%s' % mae.compute()
except KeyError:
continue
print 'Final RMSE=%s' % rmse.compute()
print 'Final MAE=%s' % mae.compute()
from python-recsys.
According to your guide,i write a code named MySVDNeiStart.py,in order to compute the RMSE and MAE of My SVD++ Model,but After 30 minutes ,it still has no result,could you help me?
import recsys.algorithm
from recsys.algorithm.factorize import SVD,SVDNeighbourhood
from recsys.datamodel.data import Data
recsys.algorithm.VERBOSE = True
filename = '/usr/local/python-recsys-master/recsys/data/movielens/ratings.dat'
data = Data()
format = {'col':0, 'row':1, 'value':2, 'ids': int}
data.load(filename, sep='::', format=format)
train, test = data.split_train_test(percent=80) # 80% train, 20% test
svd = SVDNeighbourhood()
svd.set_data(train)
svd.compute(k=100, min_values=5, pre_normalize=None, mean_center=True, post_normalize=True, savefile='/tmp/svd_neig')
#Evaluation using prediction-based metrics
from recsys.algorithm.factorize import SVD
from recsys.evaluation.prediction import RMSE, MAE
rmse = RMSE()
mae = MAE()
for rating, item_id, user_id in test.get():
try:
pred_rating = svd.predict(item_id, user_id)
rmse.add(rating, pred_rating)
mae.add(rating, pred_rating)
except KeyError:
continue
print 'Final RMSE=%s' % rmse.compute()
print 'Final MAE=%s' % mae.compute()
from python-recsys.
instead writing a single file to run, i use python console to check code. It work perfect like charm 💯
from python-recsys.
Perfect. Glad to hear that it worked fine!
from python-recsys.
Related Issues (20)
- SVD.compute() kernel fail on Windows HOT 4
- SVD.similar() user or item HOT 2
- Python 3 support HOT 1
- replace csc-pyparse with SciPy HOT 3
- Multiple Values HOT 1
- Can't install csc HOT 2
- How to increase the number of similarity/recommending item results HOT 2
- Getting error while laoding the data. HOT 2
- RuntimeWarning: invalid value encountered in divide ----Special characters in user_id HOT 4
- x Neighbours in svd.recommend HOT 1
- ImportError: No module named algorithm HOT 1
- IndexError: Error creating second index list HOT 2
- Can we load data using pandas dataframe? HOT 1
- AveragePrecision in recsys.evaluation.ranking HOT 1
- Storing results for all dataset in json file HOT 1
- Working with csv HOT 1
- how to install in python3? HOT 2
- Divisi2 what/where is it ? HOT 1
- Which version of Python is used HOT 2
- `recsys` package ownership on PyPI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-recsys.