Skip to content

Don't get any recommendations #3

Open
@23tux

Description

@23tux

Hi,

I'm not sure, if this is a bug or I'm just doing wrong. I tried out your example, and played a little bit around. By the way, really cool work ;)

But the problem is, that I don't get any recommendations from the engine. I'm using Mahout 0.7 with JRuby 1.7.3. I have the following script:

require 'rubygems'
require 'ruby-debug'
require 'jruby_mahout'

recommender = JrubyMahout::Recommender.new("PearsonCorrelationSimilarity", 2, "GenericUserBasedRecommender", false)
recommender.data_model = JrubyMahout::DataModel.new("file", { :file_path => "tmp/test.csv" }).data_model
puts recommender.estimate_preference(1,1)
# -> NaN

The test.csv is fairly simple and looks like this (user 1 haven't rated item 1):

1,2,5.0
1,3,5.0
1,4,5.0
1,5,5.0
1,6,5.0
1,7,5.0
1,8,5.0
1,9,5.0
2,1,5.0
2,2,5.0
2,3,5.0
2,4,5.0
2,5,5.0
2,6,5.0
2,7,5.0
2,8,5.0
2,9,5.0
3,1,5.0
3,2,5.0
3,3,5.0
3,4,5.0
3,5,5.0
3,6,5.0
3,7,5.0
3,8,5.0
3,9,5.0
4,1,5.0
4,2,5.0
4,3,5.0
4,4,5.0
4,5,5.0
4,6,5.0
4,7,5.0
4,8,5.0
4,9,5.0
5,1,5.0
5,2,5.0
5,3,5.0
5,4,5.0
5,5,5.0
5,6,5.0
5,7,5.0
5,8,5.0
5,9,5.0

When I try to puts recommender.estimate_preference(1,1) I always get NaN which means that the recommender isn't able to generate a rating for that user-item tuple. But my neighborhood size is only 2, and there are only items which match "perfectly" to users' 1 profile. What I'm doing wrong? Do I have to calculate the similarities on my own?

Further, calling recommender.recommend(1, 1, nil) to get a list of 1 item for user 1 returns an empty array [].

I also tried it with the movie lens dataset by splitting it 80% training and 20% testset, same results. And here the recommender throws an exception at the recommender.estimate_preference(user,item) point:

GenericDataModel.java:213:in `getPreferencesFromUser': org.apache.mahout.cf.taste.common.NoSuchUserException: 318
    from GenericDataModel.java:245:in `getPreferenceValue'
    from FileDataModel.java:654:in `getPreferenceValue'
    from GenericUserBasedRecommender.java:107:in `estimatePreference'
    from NativeMethodAccessorImpl.java:-2:in `invoke0'
    from NativeMethodAccessorImpl.java:39:in `invoke'
    from DelegatingMethodAccessorImpl.java:25:in `invoke'
    from Method.java:597:in `invoke'
    from JavaMethod.java:470:in `invokeDirectWithExceptionHandling'
...

Hope you can help me, I would love to use your project for my master thesis experiments ;) (and of course, cite your work)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions