はい、そうです。
デシジョン ツリーは、各機能にポイントを投影し、最適な分割を見つけます。この分割は、さまざまなメトリックによって決定できます。たとえば、ジニ インデックスまたはエントロピー (情報ゲイン) Sci-kit の学習では、sklearn.treeにこれがあります。
5 つのデータ ポイントがあるとします。
color shape fruit
orange oblong orange
red round apple
orange round orange
red oblong apple
red round apple
したがって、トレーニングするには、次のようにします。
feature class | feature class
orange orange | oblong orange
red apple | round apple
orange orange | round orange
red apple | oblong apple
red apple | round apple
ご覧のとおり、最適な分割は色です。このデータセットでは、色 = 赤の場合は果物 = リンゴ、色 = オレンジの場合は果物 = オレンジです。
これらのデータ ポイントでトレーニングすると、決定木が得られます。
color
___________________
| |
| |
red orange
apple orange
実際には、これらの分割は数値に基づいていますnum > .52
。
これにどのアルゴリズムを使用するかは、状況によって異なります。独自のデータについて調査を行う必要があります。これは、データセットごと/好みの種類のものであることが多いためです。
上記の例では、次のように sci-kit Learn を使用できます。
from sklearn.trees import DecisionTreeClassifier
#make your sample matrix
samples = [[1,1], [0,0], [1,0], [0,1], [0,0]]
#make your target vector ( in this case fruit)
fruitname = [1, 0, 1, 0, 0]
#create and fit the model
dtree = DecisionTreeClassifier()
dtree = dtree.fit(samples, fruitname)
#test an unknown red fruit that is oblong
dtree.predict([0,1])
color=1 は果物がオレンジ色であることを意味し、shape=1 は果物が長方形であることを意味することに注意してください。
より詳細な概要については、sci-kitユーザー ガイドを参照してください。