Working with decision trees

不羁岁月 提交于 2019-12-22 04:36:17

问题


I know tl;dr;

I'll try to explain my problem without bothering you with ton's of crappy code. I'm working on a school assignment. We have pictures of smurfs and we have to find them with foreground background analysis. I have a Decision Tree in java that has all the data (HSV histograms) 1 one single node. Then tries to find the best attribute (from the histogram data) to split the tree on. Then executes the split and creates a left and a right sub tree with the data split over both node-trees. All the data is still kept in the main tree to be able to calculate the gini index.

So after 26 minutes of analysing smurfs my pc has a giant tree with splits and other data. Now my question is, can anyone give me a global idea of how to analyse a new picture and determine which pixels could be "smurf pixels". I know i have to generate a new array of data points with the HSV histograms of the new smurf and then i need to use the generated tree to determine which pixels belong to a smurf.

Can anyone give me a pointer on how to do this?

Some additional information.
Every Decision Tree object has a Split object that has the best attribute to split on, the value to split on and a gini index.

If i need to provide any additional information I'd like to hear it.


回答1:


OK. Basically, in unoptimized pseudo-code: In order to label pixels in a new image:

For each pixel in the new image:

  • Calculate pixel's HSV features
  • Recursively, starting from the tree's root :
  • Is this a leaf? if it is, give the pixel the dominant label of the node.
  • Otherwise, check the splitting criterion against the pixel's features, and go to the right or left child accordingly

I hope this makes sense in your context.



来源:https://stackoverflow.com/questions/4983882/working-with-decision-trees

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!