저는 mahout-distribution-0.9를 사용하고 있습니다. 내 프로그램에 문제가있다.Mahout Recommender 출력이 없습니다 - 입력 파일 형식에 대해
import java.io.File;
import java.util.List;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.similarity.UserSimilarity;
import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
import org.apache.mahout.cf.taste.recommender.RecommendedItem;
import org.apache.mahout.cf.taste.recommender.Recommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
class RecommenderIntro {
public static void main(String[] args) throws Exception {
DataModel model =
//new FileDataModel (new File("F:\\ml-10M100K\\intro.csv"));
new FileDataModel (new File("F:\\ml-10M100K\\ratingsShort.dat"),"::");
UserSimilarity similarity = new PearsonCorrelationSimilarity (model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood (2, similarity, model);
Recommender recommender = new GenericUserBasedRecommender (model, neighborhood, similarity);
List<RecommendedItem> recommendations = recommender.recommend(1, 2);
for (RecommendedItem recommendation : recommendations) {
System.out.println(recommendation);
}
}
}
파일 intro.csv의 콘텐츠는 같다 :
RecommendedItem[item:104, value:4.257081]
RecommendedItem[item:106, value:4.0]
내용의 :
1,101,5.0
1,102,3.0
1,103,2.5
2,101,2.0
2,102,2.5
2,103,5.0
내가 이것을 실행 intro.csv를 사용, 그것은 일식의 출력을 가지고 파일 ratingsShort.dat은 다음과 같습니다 :
1::122::5::838985046
1::185::5::838983525
1::231::5::838983392
1::292::5::838983421
2::733::3::868244562
2::736::3::868244698
또는 ratingsShort.dat의 내용을 다음으로 변경하십시오.
1,539,5
1,589,5
2,110,5
2,151,3
2,733,3
2,802,2
2,1210,4
2,1544,3
3,1246,4
3,1408,3.5
3,1552,2
3,1564,4.5
ratingsShort.dat를 사용할 때 eclipse에는 출력이 없습니다.
FileDataModel(File dataFile, String delimiterRegex)
Mahout의 방법은이 용도를 지원하지만 출력이없는 이유는 무엇입니까?
나에게 조언을 해주는 사람이 누구일까요? 고마워요!
감사합니다 .. @ pferrel – Samt