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),
then we open the data file under our weka installation path through the open file in the upper left corner, select the
picture , open the file, we can use other text editors to see our training outside The data set is as follows:
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).
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.
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
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.
The data to be predicted are as follows:
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.