It should work on your own project if the same code works fine on mia pacakge.
It has no matter whether it is a Java project or a Maven project.
Are you sure the code in your own project is compiled successfully?

-Shengchao

-----Original Message----- From: Iñigo Llamosas
Sent: Tuesday, January 15, 2013 5:49 AM
To: [email protected]
Subject: creating projects in eclipse

Hi everybody,

I am trying to create mahout projects in Eclipse from scratch. I am
creating them as Java projects and then adding the required libraries in
the build path as required.
Now I want to run the following code in the main class:

 public static void main(String[] args) throws Exception {

   DataModel model = new FileDataModel(new
File("/usr/local/mahout-book-master/src/main/java/mia/recommender/ch04/sample.dat"));
   UserSimilarity similarity = new EuclideanDistanceSimilarity(model);
   UserNeighborhood neighborhood = new NearestNUserNeighborhood(100,
similarity, model);
   Recommender recommender = new GenericUserBasedRecommender(model,
neighborhood, similarity);
   List<RecommendedItem> recommendations = recommender.recommend(1, 5);
System.out.println(recommendations);
System.exit(0);
...

If I run this on my own project, there's no output ([]). But if I create an
extra class inside mia.recommender.ch04, for example, it works fine. That
is, for example:

[RecommendedItem[item:590, value:5.0], RecommendedItem[item:110,
value:5.0], RecommendedItem[item:151, value:3.0]]

This obviously brings me to the conclussion that I am missing something on
my project. But data is loaded, libraries are imported...

1. What could it be, and if so, could it be fixed being a Java project, or
do I need to switch it to Maven project?
2. Generally speaking, is it possible to create mahout projects as Java
projects or I will sooner or later have to create them as Maven projects?

Thank you very much

Inigo

Reply via email to