使用决策树 [英] Working with decision trees
问题描述
我知道tl; dr;
I know tl;dr;
我会试着解释一下我的问题,而不用烦乱的代码来打扰你。我正在完成一项学校作业。我们有蓝精灵的图片,我们必须通过前景背景分析找到它们。我在java中有一个决策树,其中所有数据(HSV直方图)都是一个节点。然后尝试找到最佳属性(来自直方图数据)以分割树。然后执行拆分并创建左侧和右侧子树,并在两个节点树上拆分数据。所有数据仍然保存在主树中,以便能够计算基尼指数。
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.
因此,在分析了蓝精灵的26分钟后,我的电脑有一棵巨大的树,有分裂和其他数据。现在我的问题是,任何人都可以给我一个关于如何分析新图片并确定哪些像素可能是蓝图像素的全局概念。我知道我必须使用新smurf的HSV直方图生成一个新的数据点数组,然后我需要使用生成的树来确定哪些像素属于蓝精灵。
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?
一些额外的信息。
每个决策树对象都有一个最好的Split对象要拆分的属性,要拆分的值和基尼指数。
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.
推荐答案
好的。基本上,在未经优化的伪代码中:为了标记新图像中的像素:
OK. Basically, in unoptimized pseudo-code: In order to label pixels in a new image:
对于新图像中的每个像素:
For each pixel in the new image:
- 计算像素的HSV特征
- 递归地,从树的根开始:
- 这是一个叶?如果是,请为像素指定节点的主要标签。
- 否则,请根据像素的功能检查分割标准,并相应地转到右侧或左侧子项
- 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.
这篇关于使用决策树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!