7

I follow the PyBrain tutorial Classification with Feed-Forward Neural Networks and want to build my own classifier.

I do not understand how _convertToOneOfMany modifies outputs.

Why would initial operation alldata.addSample(input, [klass]) create more than one output neuron per class?

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
user425720
  • 3,578
  • 1
  • 21
  • 23

3 Answers3

6

nevermind, here is doc explaining this stuff http://pybrain.org/docs/tutorial/datasets.html

user425720
  • 3,578
  • 1
  • 21
  • 23
  • 1
    thanks for this answer, but I don't quite follow the doc "many algorithms work better if classes are encoded into one output unit per class". may I ask what is "one output unit per class"? – hihell Oct 16 '14 at 16:53
  • wow, it was years ago, I can hardly remember - Isn't it connected to neural network structure? So, a neuron can emit output to one or many neurons in another layer? – user425720 Oct 17 '14 at 08:43
  • yes it is related to NT structure. actually I figured out myself, "one output unit per class" means if you have 3 classed, it'd be better if you also have 3 output units. and _convertToOneOfMany does this for you by expand/shrink output units to the number of your target classes – hihell Oct 18 '14 at 12:37
2

Target number is [0,1,2], this function translate them to (001,010,100). This is because many algorithms work better if classes are encoded into one output unit per class

JunWangCas
  • 89
  • 1
  • 7
1

The relevant part in the docs is the page Using Datasets: classification – Datasets for Supervised Classification Training:

When doing classification, many algorithms work better if classes are encoded into one output unit per class, that takes on a certain value if the class is present. As an advanced feature, ClassificationDataSet does this conversion automatically:

However, this is not an satisfying answer as I don't understand either why there should be more than one output neuron per class in the first hand.

Update: I recommend using keras

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958