- Python Machine Learning Cookbook(Second Edition)
- Giuseppe Ciaburro Prateek Joshi
- 136字
- 2021-06-24 15:40:49
Getting ready
You can download the dataset at https://archive.ics.uci.edu/ml/datasets/Car+Evaluation.
You need to treat each value in the dataset as a string. We consider six attributes in the dataset. Here are the attributes along with the possible values they can take:
- buying: These will be vhigh, high, med, and low.
- maint: These will be vhigh, high, med, and low.
- doors: These will be 2, 3, 4, 5, and more.
- persons: These will be 2, 4, and more.
- lug_boot: These will be small, med, and big.
- safety: These will be low, med, and high.
Given that each line contains strings, we need to assume that all the features are strings and design a classifier. In the previous chapter, we used random forests to build a regressor. In this recipe, we will use random forests as a classifier.