I would like to build a Neural Network that at the same time output a label for classification and a value for regression. I would like to do that using Keras. Right now my code is only for classification:
mdl = Sequential()
mdl.add(Dense(100, activation='relu', input_dim=X_train.shape[1]))
mdl.add(Dense(200, activation='relu'))
mdl.add(Dense(100, activation='relu'))
mdl.add(Dense(6, activation='softmax'))
mdl.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])
# early stopping implementation
filepath="weights.best.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1,
save_best_only=True, mode='max')
early_stop = EarlyStopping(monitor='val_acc', patience=100, mode='max')
callbacks_list = [checkpoint, early_stop]
# fit network
history = mdl.fit(X_train, y_train, epochs=2000, batch_size=32,
validation_split=0.2, verbose=2, shuffle=True, callbacks=callbacks_list)
So right now I have a softmax activation function on the output layer that correspond to the probability that I use for classification. How can I modify this code to output also a continuos value that will represent my regression problem. I know that Keras Functional API allow to specify multi input and multi output network. Anyone that have an idea on how can I do that?