I am new to ANN and ML. I write a simple piece of code using keras to train my ANN. This ANN has 165 inputs and 1 output with multiple observations (regression model). My problem here is that both acc and val_acc are zero, which makes no sense to me. I am not sure what is the root causes, my model setting or my data. And two other problems are 1) if I train this model twice, different results will be obtained; and 2) for the model evaluation, which data sets I should use, train data or test data? Thanks!
model = keras_model_sequential()
model %>% layer_dense(units = 10, activation = 'relu', input_shape = 165)
model %>% layer_dense(units = 6, activation = 'relu')
model %>% layer_dense(units = 1)
summary(model)
model %>% compile(
loss = "mean_absolute_percentage_error",
optimizer = optimizer_adam(lr = 0.001, beta_1 = 0.9, beta_2 = 0.999 ),
metrics = c('accuracy')
)
Fitted_model = model %>% fit(
x_train, y_train,
epochs = 50, batch_size = 20,
validation_split = 0.2
)
score <- model %>% evaluate(
x_train, y_train
)
cat('Test loss:', score$loss, '\n')
cat('test accuracy:', score$acc, '\n')
y_predict <- model %>% predict(x_test, batch_size = 128)