Ask Your Question

The delta (Huber loss function parameter) value of the CvGBTrees

asked 2013-02-22 03:23:49 -0600

aGiant gravatar image

i want to change the delta (Huber loss function parameter) value of CvGBTrees, where / how can i set it? Please help me!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-22 03:40:54 -0600

berak gravatar image

updated 2013-02-22 03:43:20 -0600

you can make an instance of CvGBTreesParams, set your values, and pass that to either the CvGBTrees constructor, or the train method

unfortunately, it's the very last param, so you'll end up with a beast similar to this:

CvGBTreesParams params;
params.loss_function_type = HUBER_LOSS;

CvGBTrees tree( trainData,tflag,responses, Mat(), Mat(), Mat(), Mat(), params ); //lots of default args
edit flag offensive delete link more


Thanks for your answers. But if I want to change the value of delta, actually alpha value of the corresponding quintile function for Huber Loss Function, how can I do that?

aGiant gravatar imageaGiant ( 2013-02-22 05:56:59 -0600 )edit

hmm, bear with me, i got no deeper knowledge about gbtrees, but ...

looking at modules/ml/src/gbt.cpp, l 475, it looks like alpha is hardcoded to 0.2, and delta is the outcome of a calculation there.

so, only choice you have is to hack into the src, and recompile the module ;(

berak gravatar imageberak ( 2013-02-22 06:16:33 -0600 )edit

Perfect!! That works!! Thank you very much!

aGiant gravatar imageaGiant ( 2013-02-22 06:34:30 -0600 )edit

ah, cool ;)

berak gravatar imageberak ( 2013-02-22 06:41:08 -0600 )edit

But I really don't think they are using the right Quantil Function. Because the original code is "delta = residuals[int(ceil(n*alpha))];", which should be quantil(residuals,alpha). If sigma is the standard deviation, mu the mean of residuals and q the inverse value of normal distribution of alpha, then delta = q * sigma + mean. If alpha = 0.99 then q = 2.326348.

aGiant gravatar imageaGiant ( 2013-02-22 08:26:46 -0600 )edit

shame on me, but that's waaay over my head ;( ( i understand your reasoning above, but total lost at what the code' s doing there..)

so, if you think, there's changes to be made, make an issue here: or here (they love pull requests!)

berak gravatar imageberak ( 2013-02-22 09:18:00 -0600 )edit

Question Tools


Asked: 2013-02-22 03:23:49 -0600

Seen: 1,585 times

Last updated: Feb 22 '13