Machine Learning Coding Tutorial 4. Testing Accuracy

Machine Learning Coding Tutorial 4. Testing Accuracy

In this tutorial, we are going to write a program testing machine learning prediction accuracy.

1. Pipeline

First, we need to import Iris data set.

Then we will split data to setup training data and labeling data.

In the example, we will use Decision Tree Classifier and K neighbors classifier to make predictions.

Finally, we compare the label data and prediction to get accuracy.

2. Coding

Let’s head into Python for a programmatic example.

Create a python file pipeline.py and write following code to program.

Please read comments carefully to understand the meaning of codes.

Run the program with the following command in Terminal (Mac) or Command Prompt (Windows):

 

Leave a Reply

Your email address will not be published. Required fields are marked *