How to a decision tree in matlab? including inputting data
Show older comments
hello,
I am fairly new to matlab however I am looking to make a decision tree. How can I input my data for the decision tree from excel? and how to I add my parameters? I read this answer https://www.mathworks.com/help/stats/view-decision-tree.html but I am still unsure.
1) How to input data from excel
2) How to run program for deicison tree
3) how to add parameters (ex: if x3<2.45 then node 2 elseif x3>=2.45 then node 3 else setosa)
Answers (1)
Image Analyst
on 3 Oct 2021
0 votes
To get data from Excel, try readmatrix(). Attach your workbook if you can't do it.
On the Home tab, try regression learner. Tell it your inputs and output and tell it to "Train" on the tree models. Then export the best model with the Export button.
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!