mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Ott <alex...@gmail.com>
Subject Re: A question about "RecommenderIntro.java" example in" Mahout in Action" book
Date Wed, 13 Jun 2012 14:01:52 GMT
Hi

You need to have "intro.csv" file in the same directory where you
running example. You can achieve this by one of following ways:
 - copy intro.csv into top directory of MiA examples, or
 - set working directory in the settings for given program in your IDE
(for Eclipse, you can specify settings in "Run As..." menu, if I
remember correctly)
 - change file name in source code, so it will point to correct file...

On Wed, Jun 13, 2012 at 3:56 PM, Yaprak Ayazoglu
<yaprak.ayazoglu@gmail.com> wrote:
> By the way,
>
> I want to give more detailed information about the error that I asked a few
> minutes ago:
>
> The place that I'm having an error is in the line below in
> "RecommenderIntro()" class:
>
> [code]
> DataModel model = new FileDataModel(new File("intro.csv"));
> [/code]
>
> "new FileDataModel(...)" calls the constructor of FileDataModel class and a
> code snippet of this constructor is given below:
>
> [code]
> public FileDataModel(File dataFile, boolean transpose, long
> minReloadIntervalMS) throws IOException {
>    Preconditions.checkArgument(dataFile != null, "dataFile is null");
>    if (!dataFile.exists() || dataFile.isDirectory()) { //
> dataFile.exists() is false here
>      throw new FileNotFoundException(dataFile.toString()); // thus,
> exception is thrown at this line.
>    }
> ...
> [/code]
>
> While debugging I realized that dataFile.exists() part is "false"
> (explainations are given at the code snippet above). However, I just
> downloaded the source codes from website of "Mahout in Action" and I just
> ran the code without making any difference.
>
> Let me write the error as below:
>
> [error]
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/home/ya/.m2/repository/org/slf4j/slf4j-jcl/1.6.0/slf4j-jcl-1.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/home/ya/.m2/repository/org/slf4j/slf4j-log4j12/1.5.11/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> Exception in thread "main" java.io.FileNotFoundException: intro.csv
>    at
> org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:160)
>    at
> org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:146)
>    at mia.recommender.ch02.RecommenderIntro.main(RecommenderIntro.java:26)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:601)
>    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> [/error]
>
> Do you have any idea for the reason of this problem?
>
> On Wed, Jun 13, 2012 at 4:25 PM, Yaprak Ayazoglu
> <yaprak.ayazoglu@gmail.com>wrote:
>
>> Hi,
>>
>> I'm following "Mahout in Action" book to learn Mahout. I'm trying to run
>> the example codes in this book. I downloaded the codes and run
>> "RecommenderIntro.java" (a code at chapter 2 - ch2).
>>
>> After running this code I get the following error:
>>
>> Exception in thread "main" java.io.FileNotFoundException: intro.csv
>> at
>> org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:160)
>> at
>> org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:146)
>> at mia.recommender.ch02.RecommenderIntro.main(RecommenderIntro.java:26)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:601)
>> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>>
>> Can you help me to solve this problem?
>>
>> Thanks.
>>
>> --
>> Yaprak
>>
>>
>
>
> --
> Yaprak



-- 
With best wishes,                    Alex Ott
http://alexott.net/
Tiwtter: alexott_en (English), alexott (Russian)
Skype: alex.ott

Mime
View raw message