September 2017
Beginner to intermediate
304 pages
7h 2m
English
We will again utilize the iris dataset for this example. You have already learned how to handle this dataset in github.com/sjwhitworth/golearn, and we can follow a similar pattern again. We will again use cross-validation. However, this time we will fit a decision tree model:
// Read in the iris data set into golearn "instances". irisData, err := base.ParseCSVToInstances("iris.csv", true) if err != nil { log.Fatal(err) } // This is to seed the random processes involved in building the // decision tree. rand.Seed(44111342) // We will use the ID3 algorithm to build our decision tree. Also, we // will start with a parameter of 0.6 that controls the train-prune split. tree := trees.NewID3DecisionTree(0.6) // Use cross-fold ...Read now
Unlock full access