Username Remember Me?
Password   forgot password?
   
   
Is it possible to use a cost function with the ‘crossval’ function? 
Posted: 27 August 2010 10:57 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  16
Joined  2009-09-22

Hello,

I am trying to calculate the error rate using crossval with normal Bayes classifiers, ldc and qdc, with a cost function, but I keep getting errors when I try and add in the cost function. I thought it would be similar to Listing 9.2 with scalem, so I tried

ldc_cost = ldc*costm([],costf’);
err_ldc_cost = crossval(z,ldc_cost,500);

but it did not work because it said the classifier cannot be trained.

How can I add in a cost function and still use crossval?

Thanks in advance,

Thomas

Profile
 
 
Posted: 11 September 2010 10:28 PM   [ Ignore ]   [ # 1 ]  
Moderator
RankRankRankRank
Total Posts:  250
Joined  2008-11-08

Classification costs are a property of the dataset instead of the classifier. So crossvalidation should be written as:

err = crossval(z*costm([],costf),ldc,500)

Bob Duin

Profile