Hey i train a neural network with keras. I have 14 categories. Everything works and there is no error. But when I look at the result I see that the last 3 trained categories are completely wrong. No testobject is connected to the 3 categories.
I already changed the order of the input but also the last 3 categories are not learned by the model.
I also used 2 different activation-functions in the last layer (sigmoid and softmax) and also 2 different optimizers (adam and sgd)
Is there a maximum number of categories?
Here is my code:
model = keras.models.Sequential()
model = Sequential()
model.add(Dense(units=50, input_dim = trainingsdaten.shape[1],
kernel_initializer='glorot_uniform',
bias_initializer='zeros',
activation='tanh'))
model.add(Dense(units=50, input_dim = 50,
kernel_initializer='glorot_uniform',
bias_initializer='zeros',
activation='tanh'))
model.add(Dense(output_dim = kategorien_train_one_hot.shape[1], input_dim=56,
kernel_initializer='glorot_uniform',
bias_initializer='zeros',
activation='sigmoid'))
sgd_optimizer = keras.optimizers.SGD(lr=lr, decay = decay, momentum = momentum)
model.compile(optimizer = 'adam',
loss = 'categorical_crossentropy',
metrics= ['accuracy'])
history = model.fit(trainingsdaten, kategorien_train_one_hot,
batch_size = batch_size, epochs=epochs,
verbose = verbose,
validation_split = validation_split)