Thanks Sean, you're absolutely right. Things are working nicely now.

- Matt

On Sat, Jul 7, 2012 at 3:48 AM, Sean Owen <sro...@gmail.com> wrote:
> What it really means is that there is not enough data to make a
> meaningful test here.
>
> On Sat, Jul 7, 2012 at 1:28 AM, Matt Mitchell <goodie...@gmail.com> wrote:
>> Hi,
>>
>> I have a recommender, with a boolean prefs model. I am following the
>> instructions in the MIA book, but only get this exception:
>>
>> Illegal precision: NaN
>>   [Thrown class java.lang.IllegalArgumentException]
>>
>> Restarts:
>>  0: [QUIT] Quit to the SLIME top level
>>
>> Backtrace:
>>   0: 
>> com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
>>   1: 
>> org.apache.mahout.cf.taste.impl.eval.IRStatisticsImpl.<init>(IRStatisticsImpl.java:35)
>>   2: 
>> org.apache.mahout.cf.taste.impl.eval.GenericRecommenderIRStatsEvaluator.evaluate(GenericRecommenderIRStatsEvaluator.java:212)
>>
>> The code is written in Clojure, I hope that's OK:
>>
>> (let [model (GenericBooleanPrefDataModel.
>>              (GenericBooleanPrefDataModel/toDataMap
>>               (FileDataModel. (File. "resources/test.data"))))
>>       evaluator (GenericRecommenderIRStatsEvaluator.)
>>       rbuilder (reify RecommenderBuilder
>>                  (buildRecommender [this model]
>>                    (let [sim (LogLikelihoodSimilarity. model)
>>                          nhood (NearestNUserNeighborhood. 10 sim model)]
>>                      (GenericBooleanPrefUserBasedRecommender. model
>> nhood sim))))
>>       mbuilder (reify DataModelBuilder
>>                  (buildDataModel [this training-data]
>>                    (GenericBooleanPrefDataModel.
>>                     (GenericBooleanPrefDataModel/toDataMap training-data))))]
>>   (.evaluate evaluator rbuilder mbuilder model nil 10
>>              GenericRecommenderIRStatsEvaluator/CHOOSE_THRESHOLD
>>              1.0))
>>
>> My test data file is very simple (for now):
>>
>> 1,1
>> 1,2
>> 1,3
>>
>> 2,1
>> 2,10
>> 2,100
>> 2,20
>>
>> 3,9
>> 3,10
>> 3,20
>> 3,1
>>
>> 4,10
>> 4,15
>> 4,1
>>
>> Any idea what I might be doing wrong?
>>
>> Thanks in advance,
>>
>> - Matt

Reply via email to