我正在尝试编译一个示例 Mahout 代码。但是我在导入 GenericBooleanPrefItemBasedRecommender 时遇到问题。当我检查我的系统时,找到了库并且目录中的其他库导入没有问题。有人可以指出我的错误吗?下面是我的代码片段和结果输出。谢谢。
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] 正在扫描项目...
[信息]
[信息] --------------------------------------------- -------------------------
[INFO] 建筑 mahoutrec 1.0-SNAPSHOT
[信息] --------------------------------------------- -------------------------
[信息]
[信息] --- maven-resources-plugin:2.4.3:resources (default-resources) @ mahoutrec ---
[INFO] 使用 'UTF-8' 编码复制过滤的资源。
[INFO] 跳过不存在的资源目录 /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/resources
[信息]
[信息] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ mahoutrec ---
[INFO] 将 1 个源文件编译到 /Users/name/Downloads/mahout/trunk/mahoutrec/target/classes
[信息] --------------------------------------------- --------------
[错误] 编译错误:
[信息] --------------------------------------------- --------------
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,8]
找不到标志
符号:变量推荐器
位置:类 com.unresyst.UnresystBoolRecommend
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,26] 找不到符号
符号:类 GenericBooleanPrefItemBasedRecommender
位置:类 com.unresyst.UnresystBoolRecommend
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[50,48] 找不到符号
符号:变量推荐器
位置:类 com.unresyst.UnresystBoolRecommend
[信息] 3 个错误
[信息] --------------------------------------------- --------------
[信息] --------------------------------------------- -------------------------
[信息] 构建失败
[信息] --------------------------------------------- -------------------------
[INFO] 总时间:3.628s
[INFO] 完成时间:2014 年 1 月 13 日星期一 15:27:22 EET
[INFO] 最终内存:10M/81M
[信息] --------------------------------------------- -------------------------
[错误] 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mahoutrec: Compilation failure: Compilation failure:
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,8] 找不到符号
[ERROR] 符号:变量推荐器
[错误] 位置:com.unresyst.UnresystBoolRecommend 类
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[45,26] 找不到符号
[错误] 符号:类 GenericBooleanPrefItemBasedRecommender
[错误] 位置:com.unresyst.UnresystBoolRecommend 类
[错误] /Users/name/Downloads/mahout/trunk/mahoutrec/src/main/java/com/unresyst/UnresystBoolRecommend.java:[50,48] 找不到符号
[ERROR] 符号:变量推荐器
[错误] 位置:com.unresyst.UnresystBoolRecommend 类
[错误] -> [帮助 1]
[错误]
[错误] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。
[错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。
[错误]
[错误] 有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException