Если строим дерево решение, основанное на алгоритме ID3, вы можете ссылаться на этот псевдокод.
ID3 (Examples, Target_Attribute, Attributes)
Create a root node for the tree
If all examples are positive, Return the single-node tree Root, with label = +.
If all examples are negative, Return the single-node tree Root, with label = -.
If number of predicting attributes is empty, then Return the single node tree Root,
with label = most common value of the target attribute in the examples.
Otherwise Begin
A ← The Attribute that best classifies examples.
Decision Tree attribute for Root = A.
For each possible value, vi, of A,
Add a new tree branch below Root, corresponding to the test A = vi.
Let Examples(vi) be the subset of examples that have the value vi for A
If Examples(vi) is empty
Then below this new branch add a leaf node with label = most common target value in the examples
Else below this new branch add the subtree ID3 (Examples(vi), Target_Attribute, Attributes – {A})
End
Return Root
Если вы хотите узнать больше об алгоритме ID3, пожалуйста, перейдите по ссылке ID3 algorithm
Существует не один способ реализации дерева решений. Есть * много * разных методов и алгоритмов. Вы можете вручную указать параметры. Вы можете создать таблицу решений так же, как и ту, что у вас есть, и запросить ее. Вы могли бы использовать даже фактическое дерево, узлами которого являются метки правил. Поиск конкретного ответа тогда будет таким же, как поиск листового узла с определенным путем. –
. Я ищу самый простой способ его реализации ... Нужно руководствоваться. – Revolt
Самый простой способ - прочитать о деревьях решений и реализациях и найти тот, который лучше всего подходит вам. –