Open leobarlach opened 4 years ago
Hi, I'm getting an error saying derivative contains NA, even with cross entropy as error function:
library(neuralnet) library(tidyverse) framingham <- read_csv('https://courses.edx.org/assets/courseware/v1/7022cf016eefb6d3747447589423dab0/asset-v1:MITx+15.071x+3T2019+type@asset+block/framingham.csv', col_types = cols(.default = 'i',sysBP = 'n', diaBP = 'n', BMI = 'n' )) # Split data set.seed(123); train_idx <- sample(nrow(framingham), 2/3 * nrow(framingham)) framingham_train <- framingham[train_idx, ] framingham_test <- framingham[-train_idx, ] # Binary classification nn <- neuralnet(formula = TenYearCHD ~ ., data = framingham_train, hidden=c(3,2), act.fct = "tanh", stepmax = 1e8, err.fct = 'ce', linear.output = TRUE)
The error I'm getting is:
Error: the error derivative contains a NA; varify that the derivative function does not divide by 0 (e.g. cross entropy)
I think the problem is that the data contains missing values, which cannot be handled by the package. The error message should be improved, i.e. add a check for missing values.
Hi, I'm getting an error saying derivative contains NA, even with cross entropy as error function:
The error I'm getting is: