_convertToOneOfMany in PyBrain
Asked Answered
T

3

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?

Trocki answered 16/11, 2011 at 16:0 Comment(3)
Hi, you forgot to mark your question as answered.Naughty
i answered it myself, so maybe I will skip thatTrocki
@Trocki Even if you answered yourself, you should mark it as answered. Then people know that this solved the problem for you.Baker
T
6

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

Trocki answered 29/11, 2011 at 13:25 Comment(3)
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"?Squirt
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?Trocki
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 classesSquirt
P
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

Pantsuit answered 6/7, 2014 at 6:28 Comment(0)
B
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

Baker answered 15/6, 2014 at 15:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.