It still means the same thing. 220K lines may still be too sparse to
get results. Also try removing your threshold and let it pick.

On Sat, Jul 14, 2012 at 3:24 AM, Matt Mitchell <[email protected]> wrote:
> Hmm, still happening. I have a 220k line file with user, item and pref
> value. I am still getting the NaN error when evaluating. I'm not sure
> what to do. It also takes a long time for this error to popup, around
> 1 hour. I hate to throw code out like this, but maybe it'll be help
> someone... help me. Is it related to the evaluator settings?
>
> - Matt
>
>   (def prefs-file "data.txt")
>   (org.apache.mahout.common.RandomUtils/useTestSeed)
>   (let [model (FileDataModel. (File. prefs-file))
>         evaluator (GenericRecommenderIRStatsEvaluator.)
>         rbuilder (reify RecommenderBuilder
>                    (buildRecommender [this model]
>                      (let [sim (LogLikelihoodSimilarity. model)]
>                        (GenericBooleanPrefItemBasedRecommender. model sim))))
>         mbuilder (reify DataModelBuilder
>                    (buildDataModel [this training-data]
>                      (GenericBooleanPrefDataModel.
>                       (GenericBooleanPrefDataModel/toDataMap 
> training-data))))]
>     (prn (.evaluate evaluator rbuilder mbuilder model nil 10
>                     GenericRecommenderIRStatsEvaluator/CHOOSE_THRESHOLD
>                     0.01)))
>
>
> On Sat, Jul 7, 2012 at 11:20 AM, Matt Mitchell <[email protected]> wrote:
>> Thanks Sean, you're absolutely right. Things are working nicely now.
>>
>> - Matt
>>
>> On Sat, Jul 7, 2012 at 3:48 AM, Sean Owen <[email protected]> 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 <[email protected]> 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