Consider the iris dataset.

  1. Filter the iris dataset to retain only the setosa and versicolor species. Advanced: use the dplyr package to do that.

  2. Plot the dataset to check that the two species are linearly separable based on the length and the width of sepals. Advanced: use the ggplot2 to do that.

In the following, we only consider the length and the width of sepals.

  1. Split the dataset into a training set and a test set. Advanced: using the caret package to do that. (You may want to call set.seed() for reproducibility’s sake.)

  2. Train a perceptron based on length and the width of sepals to classify the setosa/versicolor species using the algorithm described in the Perceptron article of Wikipedia. (Only use the training set at this stage.)

  3. Estimate the efficacy of your perceptron using the test set.

Based on https://rpubs.com/FaiHas/197581.