Comments (12)
Hi,
What have you tried and what does not work?
from surprise.
Error: Wrong sim name euclidean. Allowed values are msd, pearson_baseline, cosine, pearson.
I already add euclidean sim in algo.base.py
construction_func = {'cosine': sims.cosine,
'msd': sims.msd,
'pearson': sims.pearson,
'pearson_baseline': sims.pearson_baseline
'euclidean':sims.euclidean}
but still doesnt work
from surprise.
There's a missing comma in your dict but I suppose your code is correct, else you would have gotten an error there?
You seem to have done it correctly, so my guess would be that you are not using your custom version of surprise but rather the one that you have installed from PyPI? Maybe try a dirty print('BLABLA')
in your code and see if it's printed?
Also, have you installed it locally in dev mode with pip install -e .
? The -e
is very important. In addition, as you have modified a Cython file, you will need to reinstall the package at each change.
from surprise.
Ok thanks, i have recorrect the coma. But it still doesnt work. I create euclidean metric is base in surprise lib. I only change the calculation
Cosine:
denum = np.sqrt(sqi[xi, xj] * sqj[xi, xj])
sim[xi, xj] = prods[xi, xj] / denum
sim[xj, xi] = sim[xi, xj]
To:
sim[xi, xj] = (proda[xi, xj] - prods[xi, xj])**2
sim[xi, xj] = np.sqrt(sim[xi, xj])
sim[xj, xi] = sim[xi, xj]
which proda[] already defined above
from surprise.
Are you sure you are running the code that you have modified?
from surprise.
i need to install cython to run them?
i run it again with python give me an error in " cdef "
from surprise.
im really sorry, i just unfamiliar with Linux
from surprise.
No problem.
Yes you will need Cython and a C compiler.
Cython will compile the .pyx files into C code, and the C compiler will compile C code into an external extension / module.
You may be interesting in checking the contribution guidelines (you can forget coding style guidelines if you're not planning on a pull request)
from surprise.
Now i got the error.
similarities.c:4:20: fatal error: Python.h: No such file or directory
from surprise.
Try Googling this, it is a known issue (also it is not related to Surprise).
from surprise.
i already compile it from pyx/pyc and c. for similarities and algo.base. But the error still popping around.
There is no other way to create other similarity metric for KNN?
from surprise.
Well another way of doing this would be to extent the k-NN class and to redefine your own train() method, where you would compute the similarities here.
This is dirty but it would work. Note though that you would note be able to use the classic workflow for defining the similarity options.
from surprise.
Related Issues (20)
- Can Surprise work with PySpark?
- What to do if the dataset I want to read has more than three parameters HOT 1
- A bug when importing data from DataFrame HOT 2
- How do I apply ALS minimization in SVD? HOT 1
- Error: Sample larger than population or is negative? HOT 1
- Issues with running Suprise on M1 mac HOT 1
- trainset do not recommend new products
- Cross-validation kNN wrong results on custom dataset
- Possible memory leakage in SVDpp HOT 1
- GridSearchCV always recommends the first parameter combination as best HOT 2
- Wrong mapping of the raw IDs to the internal IDs
- How to remove NumPy installation in setup.py HOT 5
- Couldn't install Surprise in windows HOT 6
- No timestamp data in trainset HOT 1
- Couldn't install Surprise HOT 6
- How to do kfold crossvalidation on trainset (eg splitting movielens-100k using u1 split. then kfold crossvalidation on u1.base, test on u1.test) HOT 1
- Unexpected RMSE Differences in SVD Models with almost the same Training Data
- Compatibility with Python 3.12 HOT 10
- How does Surprise compare to LightFM? HOT 8
- Surprise throws ZeroDivisionError: float division HOT 1
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 surprise.