1
$\begingroup$

I am trying to recreate a model based on its description. The model is described as a "10 layers of size 500 ... 10". From my understanding, the size refers to the number of hidden units, which I could customize using model.add(dense)

My code looks like this:

model = Sequential() 
model.add(Conv2D(32, (3,3), activation='relu', input_shape=input_shape)
model.add(Dense(500, activation = 'relu')) 
... 
model.add(Dense(10, activation = 'softmax'))

However, it is yielding a very low accuracy rate (about 20% lower than what I was supposed to get).

Am I doing something wrong?

$\endgroup$
1
  • $\begingroup$ You should definitely elaborate more of the problem you are facing. When you say accuracy is lesser by 20%, compared to what? Is only increasing accuracy your concern? You should add a complete code snippet so that you can get better answers. $\endgroup$
    – Nischal Hp
    Jan 5 '18 at 11:09
1
$\begingroup$

There may be quite a lot of reasons for this. As I understand you try to repeat someone's results, and all you know is the architecture. Your keras architecture seems correct, but you should also take into account:

  1. Data - did the authors used data augmentation?
  2. Regularizations, such as dropout, L1, L2, batch normalization - that can significantly influence your results.
  3. Other hyper-parameters, like optimizer, batch size etc. Did you do a grid/random search of those?

If you took all this into account, provide us with more complete training code, so we don't have to guess.

$\endgroup$
0
$\begingroup$

If I get the point right based on the title of the question, in your code you are not making multi layer perceptron. You have tried to make somehow a convolutional network. In MLPs you just have to stack dense layers. Do something like the following code snippet which stacks just dense layers:

model = Sequential()
model.add(keras.layers.Dense(10))
model.add(keras.layers.Dense(10))
model.add(keras.layers.Dense(10))
model.add(keras.layers.Dense(10, activation = 'softmax'))
$\endgroup$

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.