TRANSLATE REGRESSION TREE / DECEION TREE TO SQL-LIKE RULES

4 ビュー (過去 30 日間)
BP205
BP205 2021 年 4 月 12 日
コメント済み: BP205 2021 年 6 月 2 日
I am interested in translating decision tree (regression/classification) to SQL Rule format. For example, the decision tree below, when rules are converted to SQL, it should output something like this.
I want to deploy the tree model in sql environment.
Result:
If x2 >= 3085.5 and x1 >= 115 then 14.375
If x2 >= 3085.5 and x1 < 115 then 19.625
If x2 < 3085.5 and x1 <89 and x2 <2162 then 33.3056
.
.
Until all rules/possible paths are completed.
The view(tree) function is not meeting my requirement.
Is there a code /function that does this? I would be ggrateful for help.
  2 件のコメント
Arthi Sathyamurthi
Arthi Sathyamurthi 2021 年 5 月 27 日
You can use the view(tree) to view your classification tree in SQL format. That allows you to display the model in SQL environment. Pl. provide more information on why that does not meet your requirement to clarify further.
BP205
BP205 2021 年 5 月 28 日
Thanks for your response. The result of the "View(tree) is not somethng one readily use in SQL environment, especially when the tree is big.

サインインしてコメントする。

回答 (1 件)

Rishik Ramena
Rishik Ramena 2021 年 5 月 31 日
Currently there is no MATLAB function to parse the classification tree objects and print out the path to all the leaves. This specific use case can be built using the properties which the ClassificationTree class provides. Have a look at the properties of this class and use any of the algorithms to print all the root to leaf paths in a tree. A similar implementation for the same has been answered here.
  1 件のコメント
BP205
BP205 2021 年 6 月 2 日
Thanks for your response. Appreciated!

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by