'Single Layer Perceptron with three classes

I need some help with a single layered perceptron with multiple classes.

What I need to do is classify a dataset with three different classes, by now I just learnt how to do it with two classes, so I have no really a good clue how to do it with three.

The dataset have three different classes: Iris-setosa, Iris-versicolor and Iris-versicolor.

The url with the dataset and the information is in : http://ftp.ics.uci.edu/pub/machine-learning-databases/iris/iris.data.

I really appreciate any help anyone can give to me.

Thanks a lot!



Solution 1:[1]

Let's say, we have 3 classes:

  • Red
  • Blue
  • Green

Now we build 3 classifiers

  • red v/s blue and green combined
  • blue v/s red and green combined
  • green v/s red and blue combined

This gives us 3 models.

For a new point, we classify it according to the classifier that gives us the largest distance from the 3 hyperplanes for the new point.

This strategy is called "one vs all", and you can read about it here.

Solution 2:[2]

We cannot classify a dataset with 3 classes using just one perceptron. you need to use a multilayer perceptron and have 3 output nodes for the three different classes,

  1. Iris-Setosa
  2. Iris-Versicolor
  3. Iris-Virginica

We use softmax activation function for multi-class classification problems where class membership is required on more than two class labels.

softmax is given by the formula, [1]: https://i.stack.imgur.com/K1K7F.png

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rishi Dua
Solution 2 Sujay kumar