You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Grant Ingersoll <gs...@apache.org> on 2009/08/17 17:50:05 UTC
Taste FileDataModel changes
I have a file containing: userId, itemId, float
Prior to the "big" changes in Taste, this loaded just fine. Now, I'm
getting:
[java] Exception in thread "main" java.lang.NumberFormatException:
For input string: "3135415,4.82"
[java] at
java
.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
[java] at java.lang.Long.parseLong(Long.java:412)
[java] at java.lang.Long.parseLong(Long.java:461)
[java] at
org
.apache
.mahout
.cf
.taste
.impl.model.file.FileDataModel.processLineWithoutID(FileDataModel.java:
294)
[java] at
org
.apache
.mahout
.cf
.taste
.impl.model.file.FileDataModel.processFileWithoutID(FileDataModel.java:
272)
[java] at
org
.apache
.mahout
.cf.taste.impl.model.file.FileDataModel.buildModel(FileDataModel.java:
153)
[java] at
org
.apache
.mahout
.cf.taste.impl.model.file.FileDataModel.reload(FileDataModel.java:128)
[java] at
org
.apache
.mahout
.cf.taste.impl.model.file.FileDataModel.checkLoaded(FileDataModel.java:
311)
[java] at
org
.apache
.mahout
.cf.taste.impl.model.file.FileDataModel.getNumUsers(FileDataModel.java:
357)
...
[java] Java Result: 1
It looks like it thinks the file doesn't have IDs (in buildModel)
because of line 142 in FileDataModel:
boolean hasPrefValues = firstLine.indexOf(delimiter,
firstLine.indexOf(delimiter) + 1) >= 0;
But, in my file, the first line is a comment. Here's what my file
looks like:
#comments go here
#more comments here
990,3135415,4.82
991,3135415,4.79
992,3135415,4.99
993,3135415,4.99
994,3135415,4.72
Presumably, the fix here is to iterate to the first non-comment line,
right?
-Grant
Re: Taste FileDataModel changes
Posted by Sean Owen <sr...@gmail.com>.
Good call, I'll fix that shortly.
On Mon, Aug 17, 2009 at 4:50 PM, Grant Ingersoll<gs...@apache.org> wrote:
> It looks like it thinks the file doesn't have IDs (in buildModel) because of
> line 142 in FileDataModel:
> boolean hasPrefValues = firstLine.indexOf(delimiter,
> firstLine.indexOf(delimiter) + 1) >= 0;