Giter Site home page Giter Site logo

Comments (8)

david-cortes avatar david-cortes commented on May 26, 2024 2

I'd need a more detailed piece of code to check what's wrong, including what kind of objects are _testNegatives, _testRatings, and how you generated them from triplets (user, item, rating), but for now:

  • Why are you appending gtItems? If these are lists of lists, wouldn't that leave you with a list having another list as last element?
  • Shouldn't the NDCG be evaluated only with the ratings of a user in a hold-out sample? Are you trying to use this for implicit-feedback data?
  • I assume HR is hit ratio - shouldn't this take a topN ranking among the non-training items?
  • Are you using some existing package for calculating these metrics?
lstA = [[1, 2, 3], [4, 5], [6]]
lstB = [[7, 8], [9, 10, 11], [12]]

def modify_list_el(ix):
    entryA = lstA[ix]
    entryB = lstB[ix]
    entryB.append(entryA)
    return entryB
modify_list_el(0)
>>> [7, 8, [1, 2, 3]] ## Last el. is a list
np.array(modify_list_el(0))
>>> array([7, 8, list([1, 2, 3])], dtype=object)
### This is not the expected input for _model.predict

from cmfrec.

david-cortes avatar david-cortes commented on May 26, 2024 1

The model object will actually accept both numpy arrays and lists - e.g.

CMF_obj.predict([0, 0, 0], [1, 2, 3])
CMF_obj.predict(np.array([0, 0, 0]), np.array([1, 2, 3]))

But would not work correctly with this:

CMF_obj.predict([0, 0, 0], [1, 2, [3, 4, 5]])

Although if you are not getting any error, I guess you're passing flat arrays already. Still, NDCG for explicit-feedback data (e.g. ratings) I think should be computed only with the test items, not the negative sample, unless you are trying to evaluate implicit-feedback metrics. If you are trying to fit a model to implicit-feedback data (e.g. clicks) and want to evaluate on the negative entries, you might want to try methods meant for that kind of data instead (e.g. https://www.github.com/david-cortes/ctpfrec).

from cmfrec.

sunshinelium avatar sunshinelium commented on May 26, 2024

the predict be used to rank, then eval model by hr,ngcf

from cmfrec.

sunshinelium avatar sunshinelium commented on May 26, 2024

thanks for your reply. the item is negative sample of the user. acturely, the input of cmf.predict is the form of [array[0,0,0], array[1,2,3]] . so it should be input as list not array ?i will try to change to list . i am so sorry for disturbe. and thanks for your time

from cmfrec.

sunshinelium avatar sunshinelium commented on May 26, 2024

thanks for your reply. acturely. I recommend for implicit ratings. Each user is sorted from 100 samples by the leave-one-out evalution , among which 99 negative samples ,denoted by item in code , dtype:list, and 1 positive sample ,denoted by gtItem in code, dtype:int. Therefore, the input is[ user(dtype: array), item(dtype:array)]. There were no errors during the run, but the results were much worse than the BPRMF. So this model is not suitable for implicit rating recommendations? thanks for your time and your resources. I will study it carefully

from cmfrec.

david-cortes avatar david-cortes commented on May 26, 2024

That's right, this model is not suitable for implicit-feedback data. Unlike BPR or implicit-ALS, it will not fit the model to the negative entries in the training data, so if you're looking to optimize those kinds of metrics, this is not the right choice.

from cmfrec.

sunshinelium avatar sunshinelium commented on May 26, 2024

thanks for your help. ^_^ I will try another method. I have been studying cross-domain recommendation recently and hope to have more opportunities to communicate later

from cmfrec.

david-cortes avatar david-cortes commented on May 26, 2024

Closing as the latest version includes an implicit-feedback version.

from cmfrec.

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.