user2694306
user2694306

Reputation: 4050

Can't import GenericBooleanPrefItemBasedRecommender

I am trying to compile a sample Mahout code. However I am having problems importing GenericBooleanPrefItemBasedRecommender. When I check my system the libraries is found and the other libraries in the directory import without a problem. Can someone point out my mistake? Below is a snippet of my code and the resulting output. Thanks.

package com.unresyst;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.io.IOException;

import org.apache.commons.cli2.OptionException; 
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.recommender.*;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.recommender.*;
import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator;
import org.apache.mahout.cf.taste.impl.neighborhood.*;
import org.apache.mahout.cf.taste.impl.similarity.*;
import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood;
import org.apache.mahout.cf.taste.similarity.*;
import org.apache.mahout.cf.taste.impl.neighborhood.*;
import org.apache.mahout.cf.taste.impl.similarity.*;

public class UnresystBoolRecommend {

    public static void main(String args[]) throws FileNotFoundException, TasteException, IOException,  OptionException {

        // create data source (model) - from the csv file            
        File ratingsFile = new File("datasets/dummy-bool.csv");                        
        DataModel model = new FileDataModel(ratingsFile);

        // Declare variables
        int neighborhoodsize = 25;
        int numrecommendations = 10;

        // create a simple recommender on our data
        LogLikelihoodSimilarity userSimilarity = new LogLikelihoodSimilarity(model);
        NearestNUserNeighborhood neighborhood = new NearestNUserNeighborhood(neighborhoodsize,userSimilarity,model);
        ItemSimilarity itemSimilarity = new LogLikelihoodSimilarity(model);
        ItemBasedRecommender recommender = new GenericBooleanPrefItemBasedRecommender(model, itemSimilarity);

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building mahoutrec 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ mahoutrec ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] skip non existing resourceDirectory /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/resources

[INFO]

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ mahoutrec ---

[INFO] Compiling 1 source file to /Users/name/Downloads/mahout/trunk/mahoutrec/target/classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,8]

cannot find symbol

symbol : variable recommender

location: class com.unresyst.UnresystBoolRecommend

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,26] cannot find symbol

symbol : class GenericBooleanPrefItemBasedRecommender

location: class com.unresyst.UnresystBoolRecommend

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[50,48] cannot find symbol

symbol : variable recommender

location: class com.unresyst.UnresystBoolRecommend

[INFO] 3 errors

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 3.628s

[INFO] Finished at: Mon Jan 13 15:27:22 EET 2014

[INFO] Final Memory: 10M/81M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mahoutrec: Compilation failure: Compilation failure:

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,8] cannot find symbol

[ERROR] symbol : variable recommender

[ERROR] location: class com.unresyst.UnresystBoolRecommend

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,26] cannot find symbol

[ERROR] symbol : class GenericBooleanPrefItemBasedRecommender

[ERROR] location: class com.unresyst.UnresystBoolRecommend

[ERROR] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[50,48] cannot find symbol

[ERROR] symbol : variable recommender

[ERROR] location: class com.unresyst.UnresystBoolRecommend

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Upvotes: 0

Views: 278

Answers (1)

user2694306
user2694306

Reputation: 4050

Okay, I think that I found the solution. Apparently, my pom.xml file was outdated and using version 0.4 which did not have this function defined.

Upvotes: 1

Related Questions