Weka operation realizes the relationship between playing and weather in decision tree algorithm

Weka is an open source machine learning and data mining software based on JAVA environment. Today we use weka for the first time to operate the decision tree algorithm to simulate the relationship between playing and weather. !

First, you can open the software through explore (exploration), First of all
then we open the data file under our weka installation path through the open file in the upper left corner, select the
Insert picture description here
picture , open the file, we can use other text editors to see our training outside The data set is as follows: Insert picture description here
After opening this data set, we can visually observe the proportion of going out in various corresponding situations through the lower right corner visualize all (blue means yes, red means no). Insert picture description here
a. Next switch to the classify panel.
b. Select trees->J48 classifier and use the default parameters. (Select tree to see the visualized decision tree)
c.Test options select the default ten-fold cross-validation.
d. Click the start button to start the experiment.
e. In the Classifier output on the right, we see the results of the experiment.
Insert picture description here
By Correctly Classified Instances 7 50%. We can know that the accuracy of our model is only 50%.
Then we can right-click on the option in the Result list and select visualize tree to view the graphical structure of the decision tree. As shown in the figure, if Insert picture description here
the model predicts:
we can create a set of data first, and the predicted value is in English? (The format can refer to the figure below). As shown in the test options, select the second one and open file to open the created file, and then close it.
Insert picture description here
The data to be predicted are as follows:

Insert picture description here

After start is running, right-click to open visualize classifier errors, and then click save and name it to save. Then open the file we saved to view the results. As shown in the figure, we predicted a situation of rainy, hot, high, FALSE, and the result is yes.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45701131/article/details/106717130