From: Shane on
In the new version of classregtree function in 2009b-stat toolbox, I tried to use updated AdaBoost weights for training samples, but sometimes I got the following error:

??? Error using ==> classregtreeRCcritval
Sum of weights is zero.

Error in ==> classregtree.classregtree>treefit at 782
[critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...

Error in ==> classregtree.classregtree>classregtree.classregtree at 129
a = treefit(a,x,y,varargin{:}); % calls local version of treefit

Error in ==> test at 4
t = classregtree(TrainData,TrainTarget, 'method','classification', 'weights', Weight);
-----------------------------------------------
I can't find classregtreeRCcritval.m function and I don't know why reporting a sum of weights zerio error, 'cause I check the sum of my input weights -- it's '1'!

After many experments, I feel perhaps a certain distribution of weight will lead to this error, if I change the weights, it will continue. Trunaction error? I have no clue, since I can't step into the function classregtreeRCcritval.m.

Anyone can help me? I can provide an example of my data if you asked.

Shane
From: Ilya Narsky on
Shane wrote:
> In the new version of classregtree function in 2009b-stat toolbox, I tried to use updated AdaBoost weights for training samples, but sometimes I got the following error:
>
> ??? Error using ==> classregtreeRCcritval
> Sum of weights is zero.
>
> Error in ==> classregtree.classregtree>treefit at 782
> [critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
>
> Error in ==> classregtree.classregtree>classregtree.classregtree at 129
> a = treefit(a,x,y,varargin{:}); % calls local version of treefit
>
> Error in ==> test at 4
> t = classregtree(TrainData,TrainTarget, 'method','classification', 'weights', Weight);
> -----------------------------------------------
> I can't find classregtreeRCcritval.m function and I don't know why reporting a sum of weights zerio error, 'cause I check the sum of my input weights -- it's '1'!
>
> After many experments, I feel perhaps a certain distribution of weight will lead to this error, if I change the weights, it will continue. Trunaction error? I have no clue, since I can't step into the function classregtreeRCcritval.m.
>
> Anyone can help me? I can provide an example of my data if you asked.
>
> Shane

Shane,

The fix for this problem is coming out in the next release. This problem
occurs when classregtreeRCcritval gets a vector of weights w with values
below eps(sum(w)). I have not seen your AdaBoost code obviously, but one
possible workaround might be to exclude observations with such small
weights right before the call to classregtreeRCcritval in classregtree.m:

smallw = w<eps(sum(w));
x(smallw) = [];
c(smallw,:) = [];
w(smallw) = [];
[critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
xcat,Criterion,bestcrit,minleaf);

-Ilya

From: Shane on
Thank you so much, Ilya! You save me another sleepless night :)
Just one another question: why can't I find classregtreeRCcritval.m function in my computer? Is it a secret internal function?
Shane

Ilya Narsky <inarsky(a)mathworks.com> wrote in message <hegser$4hs$1(a)fred.mathworks.com>...
> Shane wrote:
> > In the new version of classregtree function in 2009b-stat toolbox, I tried to use updated AdaBoost weights for training samples, but sometimes I got the following error:
> >
> > ??? Error using ==> classregtreeRCcritval
> > Sum of weights is zero.
> >
> > Error in ==> classregtree.classregtree>treefit at 782
> > [critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
> >
> > Error in ==> classregtree.classregtree>classregtree.classregtree at 129
> > a = treefit(a,x,y,varargin{:}); % calls local version of treefit
> >
> > Error in ==> test at 4
> > t = classregtree(TrainData,TrainTarget, 'method','classification', 'weights', Weight);
> > -----------------------------------------------
> > I can't find classregtreeRCcritval.m function and I don't know why reporting a sum of weights zerio error, 'cause I check the sum of my input weights -- it's '1'!
> >
> > After many experments, I feel perhaps a certain distribution of weight will lead to this error, if I change the weights, it will continue. Trunaction error? I have no clue, since I can't step into the function classregtreeRCcritval.m.
> >
> > Anyone can help me? I can provide an example of my data if you asked.
> >
> > Shane
>
> Shane,
>
> The fix for this problem is coming out in the next release. This problem
> occurs when classregtreeRCcritval gets a vector of weights w with values
> below eps(sum(w)). I have not seen your AdaBoost code obviously, but one
> possible workaround might be to exclude observations with such small
> weights right before the call to classregtreeRCcritval in classregtree.m:
>
> smallw = w<eps(sum(w));
> x(smallw) = [];
> c(smallw,:) = [];
> w(smallw) = [];
> [critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
> xcat,Criterion,bestcrit,minleaf);
>
> -Ilya
From: Ilya Narsky on
Shane wrote:
> Thank you so much, Ilya! You save me another sleepless night :)
> Just one another question: why can't I find classregtreeRCcritval.m function in my computer? Is it a secret internal function?
> Shane

Shane, classregtreeRCcritval is implemented in C. Normally, we do not
ship C source code.

>
> Ilya Narsky <inarsky(a)mathworks.com> wrote in message <hegser$4hs$1(a)fred.mathworks.com>...
>> Shane wrote:
>>> In the new version of classregtree function in 2009b-stat toolbox, I tried to use updated AdaBoost weights for training samples, but sometimes I got the following error:
>>>
>>> ??? Error using ==> classregtreeRCcritval
>>> Sum of weights is zero.
>>>
>>> Error in ==> classregtree.classregtree>treefit at 782
>>> [critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
>>>
>>> Error in ==> classregtree.classregtree>classregtree.classregtree at 129
>>> a = treefit(a,x,y,varargin{:}); % calls local version of treefit
>>>
>>> Error in ==> test at 4
>>> t = classregtree(TrainData,TrainTarget, 'method','classification', 'weights', Weight);
>>> -----------------------------------------------
>>> I can't find classregtreeRCcritval.m function and I don't know why reporting a sum of weights zerio error, 'cause I check the sum of my input weights -- it's '1'!
>>>
>>> After many experments, I feel perhaps a certain distribution of weight will lead to this error, if I change the weights, it will continue. Trunaction error? I have no clue, since I can't step into the function classregtreeRCcritval.m.
>>>
>>> Anyone can help me? I can provide an example of my data if you asked.
>>>
>>> Shane
>> Shane,
>>
>> The fix for this problem is coming out in the next release. This problem
>> occurs when classregtreeRCcritval gets a vector of weights w with values
>> below eps(sum(w)). I have not seen your AdaBoost code obviously, but one
>> possible workaround might be to exclude observations with such small
>> weights right before the call to classregtreeRCcritval in classregtree.m:
>>
>> smallw = w<eps(sum(w));
>> x(smallw) = [];
>> c(smallw,:) = [];
>> w(smallw) = [];
>> [critval,cutval] = classregtreeRCcritval(x,doclass,c,w,pratio,...
>> xcat,Criterion,bestcrit,minleaf);
>>
>> -Ilya