0
$\begingroup$

I am trying to learn Neural Networks using scikit-neuralnetwork framework and I know basics about Neural Networks and now trying to implement it with scikit-learn. but I am confused on 2 points.

1- what is the structure of this NN given below? Somehow, in some examples felt to me, some people don't put input layer as a layer. Otherwise, I am thinking this as a 2 layer NN has input layer with 100 nodes and 1 node at the ouput layer.

from sknn.mlp import Classifier, Layer

nn = Classifier(
   layers=[
    Layer("Maxout", units=100, pieces=2),
    Layer("Softmax")],
learning_rate=0.001,
n_iter=25)

nn.fit(X_train, y_train)

2- Does scikit-neuralnetwork do back propagation within the code that I put above?

Thank you!

$\endgroup$
1
$\begingroup$

1) From what I understand, scikit-neuralnetwork tries to automatically determine the correct input and output sizes by the X and y data you give it when calling nn.fit. Therefore structure should be:

  1. Input layer with shape determined by X_train
  2. Dense layer with 100 units and maxout activation with 2 linear pieces
  3. Softmax classification layer with as many units as needed for y_train

Seems to use input shape from data here: https://github.com/aigamedev/scikit-neuralnetwork/blob/b7fd0c089bd7c721c4d9cf9ca71eed74c6bafc5e/sknn/backend/lasagne/mlp.py#L183

And output shape from data here: https://github.com/aigamedev/scikit-neuralnetwork/blob/b7fd0c089bd7c721c4d9cf9ca71eed74c6bafc5e/sknn/mlp.py#L62

However, note that maxout seems no longer supported: https://github.com/aigamedev/scikit-neuralnetwork/issues/142

2) Yes it uses backpropagation by calling appropriate lasagne/theano functions to create/compile the backpropagation training function: https://github.com/aigamedev/scikit-neuralnetwork/blob/b7fd0c089bd7c721c4d9cf9ca71eed74c6bafc5e/sknn/backend/lasagne/mlp.py#L50-L103

(Actual training seems to happen here: https://github.com/aigamedev/scikit-neuralnetwork/blob/b7fd0c089bd7c721c4d9cf9ca71eed74c6bafc5e/sknn/backend/lasagne/mlp.py#L316-L335)

$\endgroup$
1
  • $\begingroup$ I confused myself with overthinking. I supposed that those layers are input and output layer but in fact, I saw now that is more clear, I don't need to write input layer and I just need to write the output layer and it's function. Size is already taken by the code itself self.layers[-1].units = y.shape[1] Thank you so much for all those nice well supported explanations! @robintibor $\endgroup$ – mert Feb 9 '17 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.