Giter VIP home page Giter VIP logo

Comments (12)

NicolasHug avatar NicolasHug commented on May 29, 2024

Hi,

What have you tried and what does not work?

from surprise.

BillySurya avatar BillySurya commented on May 29, 2024

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.

NicolasHug avatar NicolasHug commented on May 29, 2024

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.

BillySurya avatar BillySurya commented on May 29, 2024

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.

NicolasHug avatar NicolasHug commented on May 29, 2024

Are you sure you are running the code that you have modified?

from surprise.

BillySurya avatar BillySurya commented on May 29, 2024

i need to install cython to run them?
i run it again with python give me an error in " cdef "

from surprise.

BillySurya avatar BillySurya commented on May 29, 2024

im really sorry, i just unfamiliar with Linux

from surprise.

NicolasHug avatar NicolasHug commented on May 29, 2024

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.

BillySurya avatar BillySurya commented on May 29, 2024

Now i got the error.
similarities.c:4:20: fatal error: Python.h: No such file or directory

from surprise.

NicolasHug avatar NicolasHug commented on May 29, 2024

Try Googling this, it is a known issue (also it is not related to Surprise).

from surprise.

BillySurya avatar BillySurya commented on May 29, 2024

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.

NicolasHug avatar NicolasHug commented on May 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.