Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Pruning in decision trees - how to set penalty

Subject: Pruning in decision trees - how to set penalty

From: C

Date: 25 Jan, 2013 15:57:08

Message: 1 of 2

Hi, I have a question regarding the pruning of decision trees. I understand that the method used is to minimize the fitting error plus a penalty on the number of nodes:

(resubsitution error) + penalty * (number of nodes)


My question is, shouldn't the prune function allow us to set what the penalty weight is here? I don't see this as an option anywhere in the prune function.

Thanks in advance.


PS: I have seen this related question thread,

http://www.mathworks.com/matlabcentral/newsreader/view_thread/256011

Subject: Pruning in decision trees - how to set penalty

From: Ilya Narsky

Date: 25 Jan, 2013 21:27:34

Message: 2 of 2

"C " <calvin.price@aexp.com> wrote in message
news:kdua0k$nmu$1@newscl01ah.mathworks.com...
> Hi, I have a question regarding the pruning of decision trees. I
> understand that the method used is to minimize the fitting error plus a
> penalty on the number of nodes:
>
> (resubsitution error) + penalty * (number of nodes)
>
>
> My question is, shouldn't the prune function allow us to set what the
> penalty weight is here? I don't see this as an option anywhere in the
> prune function.
>
> Thanks in advance.
>
>
> PS: I have seen this related question thread,
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/256011
>

Strictly speaking, the criterion is

(resubsitution error) + penalty * (number of leaves)

You do have this option. Depending on what implementation you are using, do
one of: 'help ClassificationTree.prune', 'help RegressionTree.prune' or
'help classregtree.prune'. Look at the 'alpha' parameter. This parameter is
what you call the penalty weight. If you are using ClassificationTree or
RegressionTree, the cost penalty for the pruning levels is saved in the
PruneAlpha property.

-Ilya

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us