recommenders / rival

RiVal recommender system evaluation toolkit
rival.recommenders.net
Apache License 2.0
150 stars 40 forks source link

[Problem] Maven dependencies and CrossValidatedMahoutKNNRecommenderEvaluator #84

Closed afcarvalho1991 closed 9 years ago

afcarvalho1991 commented 9 years ago

Hello,

First of all it's the first time using maven so .... When I tried to add to the pom of my new maven project, I added the following:

<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-core</artifactId>
    <version>0.1</version>
</dependency>

Yet, I was getting the following error: "Missing artifact net.recommenders.rival:rival:jar:0.1", so after a few tries I used instead the following dependencies:

<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-core</artifactId>
    <version>0.1</version>
</dependency>
<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-recommend</artifactId>
    <version>0.1</version>
</dependency>
<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-package</artifactId>
    <version>0.1</version>
</dependency>
<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-split</artifactId>
    <version>0.1</version>
</dependency>
<dependency>
    <groupId>net.recommenders.rival</groupId>
    <artifactId>rival-evaluate</artifactId>
    <version>0.1</version>
</dependency>

This time, all of them worked ok (excluding the artifactId="rival")! Afterwards, when checking for errors inside the class "CrossValidatedMahoutKNNRecommenderEvaluator", I was still getting missing Classes such as:

Any guess what I might be doing wrong?

Thanks in advance, André

alansaid commented 9 years ago

Hi @afcarvalho1991, I am not entirely sure how and where you are using CrossValidatedMahoutKNNRecommenderEvaluator, this class is not part of the 0.1 release (the rival-examples module was added after that release) and should not be used together with 0.1.

I will try to give you a generic answer: Whenever you want to access a class that is in a certain maven module, you need to add a dependency to that module. The module rival-examples has not yet been released (i.e. it was not part of the 0.1 release that is on Maven Central (here)). If you try to combine the 0.1 release with the current snapshot here on Github, you will likely run into trouble as there have been considerable changes and additions since the 0.1 release. This is also not something you would do with any Maven project, stick to one release ;)

If you want to use CrossValidatedMahoutKNNRecommenderEvaluator your best bet is to check out rival from Github and build it yourself (mvn clean installin the root folder of rival) or use 0.2-SNAPSHOT from a Maven snapshot repository.

afcarvalho1991 commented 9 years ago

First of all, for taking the time to answer!

So I managed to fix the version by replacing the 0.1 to 0.2-SNAPSHOT and I currently have no compiling errors. But now I have runtime errors has can be observed in the image below.

rival_err

The error is the missing class/method: "org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood.(int, org.grouplens.lenskit.knn.user.UserSimilarity, org.apache.mahout.cf.taste.model.DataModel)"

Shouldn't the maven get the dependecies for apache manhout by itself?

Best regards, André

abellogin commented 9 years ago

Hi @afcarvalho1991, it seems the similarity is not the correct one, since it should be "org.apache.mahout.cf.taste.similarity.UserSimilarity" and not "org.apache.mahout.cf.taste.similarity.UserSimilarity".

Please, check that you do not have any conflicting property file for Lenskit and let us know.

Best, Alejandro

alansaid commented 9 years ago

@afcarvalho1991 I don't really understand why you would run the main method in CrossValidatedMahoutKNNRecommenderEvaluator from a different main method. Why not just run it directly from the rival-examples module? All you need to do is change the rival-examplespom file and point out CrossValidatedMahoutKNNRecommenderEvaluator as the mainClass (line 75 in rival-examples/pom.xml. Issuing mvn exec:java generates the following output:

/rival/rival-examples> mvn exec:java
Picked up _JAVA_OPTIONS: -Xms512m -Xmx12g
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RiVal Examples 0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ rival-examples >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ rival-examples ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (validate-environment) @ rival-examples ---
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ rival-examples <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ rival-examples ---
train: data/ml-100k/model/train_0.csv
test: data/ml-100k/model/test_0.csv
train: data/ml-100k/model/train_1.csv
test: data/ml-100k/model/test_1.csv
train: data/ml-100k/model/train_2.csv
test: data/ml-100k/model/test_2.csv
train: data/ml-100k/model/train_3.csv
test: data/ml-100k/model/test_3.csv
train: data/ml-100k/model/train_4.csv
test: data/ml-100k/model/test_4.csv
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
NDCG@10: 0.0292752140037415
RMSE: 1.108653420946922
P@10: 0.039915164369035125
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.245 s
[INFO] Finished at: 2015-03-13T09:58:29+01:00
[INFO] Final Memory: 35M/3099M
[INFO] ------------------------------------------------------------------------

If you're looking to create a simple example based on CrossValidatedMahoutKNNRecommenderEvaluator then I suggest you copy the content of that file to your project, alter it to suit your needs and run it from within your project.

afcarvalho1991 commented 9 years ago

It's solved.

I did what you suggested @alansaid:

1 - Redownloaded everything from github ( instead of using maven-rep.) 2 - cd rival-example 3 - modified the "pom.xml" to redefine mainClass as "net.recommenders.rival.examples.movielens100k.CrossValidatedMahoutKNNRecommenderEvaluator" 4 - mvn exec:java 5 - It worked out! as you shown.

My question is: Is the CrossValidatedMahoutKNNRecommenderEvaluator (@0.2-SNAPSHOT) working properly, when obtained via the maven repository ?! It's worth looking :)

The only way I made it work when using the eclipse was by importing the maven project (manually obtained from github). So to conclude:

rival-working

Thank you, André

alansaid commented 9 years ago

@afcarvalho1991 snapshots don't always work. I think this one does though. You could likely recreate what you were trying to do without calling the main method of net.recommenders.rival.examples.movielens100k.CrossValidatedMahoutKNNRecommenderEvaluator by implementing your evaluation according to the example.