rm(list = ls())
############################################library packages  
#install.packages("keras")
library(deepnet)
library(h2o)
## Warning: package 'h2o' was built under R version 4.2.3
## 
## ----------------------------------------------------------------------
## 
## Your next step is to start H2O:
##     > h2o.init()
## 
## For H2O package documentation, ask for help:
##     > ??h2o
## 
## After starting H2O, you can use the Web UI at http://localhost:54321
## For more information visit https://docs.h2o.ai
## 
## ----------------------------------------------------------------------
## 
## Attaching package: 'h2o'
## The following objects are masked from 'package:stats':
## 
##     cor, sd, var
## The following objects are masked from 'package:base':
## 
##     %*%, %in%, &&, ||, apply, as.factor, as.numeric, colnames,
##     colnames<-, ifelse, is.character, is.factor, is.numeric, log,
##     log10, log1p, log2, round, signif, trunc
library(neuralnet)
## Warning: package 'neuralnet' was built under R version 4.2.3
library(keras)
## Warning: package 'keras' was built under R version 4.2.3
library(tensorflow)
## Warning: package 'tensorflow' was built under R version 4.2.3
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0      ✔ purrr   1.0.1 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.3.0      ✔ stringr 1.5.0 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::compute() masks neuralnet::compute()
## ✖ dplyr::filter()  masks stats::filter()
## ✖ dplyr::lag()     masks stats::lag()
library(splitstackshape)
library(ROCR)
## 
## Attaching package: 'ROCR'
## 
## The following object is masked from 'package:neuralnet':
## 
##     prediction
library(pROC)
## Type 'citation("pROC")' for a citation.
## 
## Attaching package: 'pROC'
## 
## The following object is masked from 'package:h2o':
## 
##     var
## 
## The following objects are masked from 'package:stats':
## 
##     cov, smooth, var
library(mltools) 
## 
## Attaching package: 'mltools'
## 
## The following object is masked from 'package:tidyr':
## 
##     replace_na
##########################################prepare data path
dir_path_ori <- "C:\\Users\\xut2\\Desktop\\keras\\"
fs_dir <- c("auc_feature_selection")
for (ii in 1:length(fs_dir)) {
#ii = 1
dir_path <- paste0(dir_path_ori,fs_dir[ii],"\\selected_data_for_model")
dir_path_target <- list.dirs(dir_path,recursive = F)
dir_path_target
for (nn in 1:length(dir_path_target)) {
  tryCatch({
    #nn= 1
    ###creat folders for save results
    unlink(paste0(dir_path_target[nn],"\\","deepnet_test"), recursive=TRUE) #delete file and all involved 
    unlink(paste0(dir_path_target[nn],"\\","h2o_test"), recursive=TRUE) #delete file and all involved 
    unlink(paste0(dir_path_target[nn],"\\","neuralnet_test"), recursive=TRUE) #delete file and all involved 
    unlink(paste0(dir_path_target[nn],"\\","keras_test"), recursive=TRUE) #delete file and all involved 
    dir_path_name <- dir(dir_path_target[nn],pattern = "*.csv") ##input data 
    dir.create(paste0(dir_path_target[nn],"\\","deepnet_test")) 
    dir.create(paste0(dir_path_target[nn],"\\","h2o_test")) 
    dir.create(paste0(dir_path_target[nn],"\\","neuralnet_test")) 
    dir.create(paste0(dir_path_target[nn],"\\","keras_test")) 
    ##########################################bath input data 
    #aa=1 
    object_file_list <- list()
    for (aa in 1:length(dir_path_name)) {
      dir_path_file <- paste0(dir_path_target[nn],"\\",dir_path_name[aa]) 
      object_file_list[[aa]] <- read.csv(dir_path_file,
                                         check.names = T, header = T,stringsAsFactors = F)
      names(object_file_list)[aa] <- dir_path_name[aa]
    }
    #names(object_file_list)
    #############################################################model
    for (mm in 1:length(object_file_list)) {
      #mm=1
      #################################################data for model 
      data <- object_file_list[[mm]] #check point- 1
      #dim(data) #[1] 208  26
      #colnames(data)
      colnames(data) <- c(colnames(data[1:(ncol(data)-1)]),"num")
      data[,-c(1)] <- sapply(data[,-c(1)], as.numeric)###################################################ADD__1
      #data <- data.frame(sapply(data, as.numeric))
      data$num <- as.factor(data$num)
      print(str(data)); print(head(data, 3)); print(dim(data)); print(colnames(data))
      ###############################################parameter setting 
      loop <- 2 # Repeat 10 times
      n_col_newdata <- ncol(data)-1 
      n_col_newdata
      ###deepnet
      auc_deepnet <- numeric(loop)
      accuracy_deepnet <- numeric(loop)
      Balanced_accuracy_deepnet <- numeric(loop)
      mcc_result_deepnet <- numeric(loop)
      ###h2o
      auc_h2o <- numeric(loop)
      accuracy_h2o <- numeric(loop)
      Balanced_accuracy_h2o <- numeric(loop)
      mcc_result_h2o <- numeric(loop)
      ###neuralnet
      auc_neuralnet <- numeric(loop)
      accuracy_neuralnet <- numeric(loop)
      Balanced_accuracy_neuralnet <- numeric(loop)
      mcc_result_neuralnet <- numeric(loop)
      ###keras
      auc_keras <- numeric(loop)
      accuracy_keras <- numeric(loop)
      Balanced_accuracy_keras <- numeric(loop)
      mcc_result_keras <- numeric(loop)
      ###############################################divide data 
      #loop = 2
      for (j in 1:loop) {
        tryCatch({
        set.seed(j*2023)
        #j =1 
          #####################################################################
          #####################################################################
          data_test_list <- stratified(data, "num", .3)$Mapping.ID
          #data_test_list <- sample(unique(data$Mapping.ID),size = floor(length(unique(data$Mapping.ID))*0.3),replace = F)
          # Randomly shuffle the data
          #k <- 5  # 5 fold cross validation #check point
          testdata <- data[data$Mapping.ID %in% data_test_list,]
          traindata <- data[!data$Mapping.ID %in% data_test_list,]
          #dim(testdata);dim(traindata) #[1] 3840   36  [1] 8992   36
          #unique(testdata$Mapping.ID) %in% unique(traindata$Mapping.ID)
          testdata$Mapping.ID <- NULL
          traindata$Mapping.ID <- NULL
          testdata <- unique(testdata)
          traindata <- unique(traindata)
          #str(traindata);str(testdata)
          #print(head(traindata))
          #unique(traindata$num)
          #table(traindata$num) #0   1 461 311 
          #dim(testdata);dim(traindata) [1] 525  34  [1] 793  34
          #####################################################################
          #############################################deepnet
          set.seed(2023)
          fit_deepnet <- nn.train(as.matrix(traindata[, -ncol(traindata)]), 
                                  as.numeric(as.character(traindata[, ncol(traindata)])), 
                                  hidden = c(ceiling(c(ncol(traindata)-1)/2),ceiling(c(ncol(traindata)-1)/3)))
          #fit_deepnet[1:10]
          ############################
          # Predict the test set probabilities
          #For classification task,return the probability of a class
          pre_auc_deepnet <- nn.predict(fit_deepnet, testdata[, -ncol(testdata)])
          #### auc_deepnet
            modelroc_deepnet <- pROC::roc(testdata[,n_col_newdata], as.numeric(pre_auc_deepnet[,1]))
            auc_deepnet[j] <- as.numeric(auc(modelroc_deepnet))
            cutoff_deepnet <- coords(modelroc_deepnet, "best", ret = "threshold")$threshold[1]
            predict.results_deepnet <- ifelse(pre_auc_deepnet[,1] > as.numeric(cutoff_deepnet[1]),"1","0")
            freq_default_deepnet <- table(predict.results_deepnet, testdata[,n_col_newdata])
            Sensitivity_deepnet <- freq_default_deepnet[1,1]/sum(freq_default_deepnet[,1])
            Specificity_deepnet <- freq_default_deepnet[2,2]/sum(freq_default_deepnet[,2])
            accuracy_deepnet[j] <- mean(testdata[,n_col_newdata] == predict.results_deepnet)
            Balanced_accuracy_deepnet[j] <- (Sensitivity_deepnet+Specificity_deepnet)/2
            ###mcc
            preds_deepnet <- as.numeric(as.character(predict.results_deepnet))  
            actuals_deepnet <- as.numeric(as.character(testdata$num))
            mcc_result_deepnet[j] <- mcc(actuals_deepnet,preds_deepnet)
            mcc_result_deepnet[j] <- abs(mcc_result_deepnet[j])
            ##
            if (auc_deepnet[j] < 0.5) {auc_deepnet[j] = 1 - auc_deepnet[j]
            accuracy_deepnet[j] <- 1- accuracy_deepnet[j]
            Balanced_accuracy_deepnet[j] <- 1- Balanced_accuracy_deepnet[j]
            }
            print(data.frame(auc_deepnet[j], accuracy_deepnet[j], Balanced_accuracy_deepnet[j], mcc_result_deepnet[j]))
            },error=function(e){cat("ERROR :",conditionMessage(e),"\n")})
            ##############################################  h2o
        tryCatch({
            h2o.init()
            traindata_h2o <- as.h2o(traindata)
            testdata_h2o <- as.h2o(testdata)
            colnames(traindata_h2o)
            #str(traindata_h2o)
            ################################build  model
           #?h2o.deeplearning
            #?h2o.deeplearning
            #set.seed(2023)
            h2o_fit <- h2o.deeplearning(
              x = 1:c(ncol(testdata_h2o)-1),
              y = ncol(testdata_h2o),
              training_frame = traindata_h2o,
              hidden = c(ceiling(c(ncol(traindata)-1)/2),ceiling(c(ncol(traindata)-1)/3)),
              seed = 2023,  reproducible = TRUE
              )
            # Predict the test set probabilities
            #For classification task,return the probability of a class
            pred_prob_h2o <- h2o.predict(h2o_fit, testdata_h2o[, -ncol(testdata_h2o)], exact_predict = TRUE)
            roc_curve_h2o <- roc(as.numeric(as.matrix(testdata_h2o$num)), as.numeric(as.matrix(pred_prob_h2o$p1)), 
                                 plot = TRUE, print.auc=TRUE)
            roc_curve_h2o
            #### auc_h2o
            auc_h2o[j] <- as.numeric(auc(roc_curve_h2o))
            ####Balanced accuracy_h2o_method_1
            modelroc_h2o <- coords(roc_curve_h2o, "best", ret = "threshold")$threshold[1]
            #class(modelroc_h2o)
            predict.results_h2o <- ifelse(pred_prob_h2o[, grep("p1", colnames(pred_prob_h2o))] > as.numeric(modelroc_h2o[1]),"1","0")
            freq_default_h2o <- table(as.numeric(as.matrix(predict.results_h2o)),as.numeric(as.matrix(testdata_h2o[,n_col_newdata])))
            Sensitivity_h2o <- freq_default_h2o[1,1]/sum(freq_default_h2o[,1])
            Specificity_h2o <- freq_default_h2o[2,2]/sum(freq_default_h2o[,2])
            accuracy_h2o[j] <- mean(testdata_h2o[,n_col_newdata] == predict.results_h2o)
            Balanced_accuracy_h2o[j] <- (Sensitivity_h2o+Specificity_h2o)/2
            ###mcc
            preds_h2o <- as.numeric(as.matrix(predict.results_h2o))  
            actuals_h2o <- as.numeric(as.matrix(testdata_h2o$num))
            mcc_result_h2o[j] <- mcc(actuals_h2o,preds_h2o)
            mcc_result_h2o[j] <- abs(mcc_result_h2o[j])
            ##
            if (auc_h2o[j] < 0.5) {auc_h2o[j] = 1 - auc_h2o[j]
            accuracy_h2o[j] <- 1- accuracy_h2o[j]
            Balanced_accuracy_h2o[j] <- 1- Balanced_accuracy_h2o[j]
            }
            #h2o.shutdown(prompt = F)
            print(data.frame(auc_h2o[j], accuracy_h2o[j],Balanced_accuracy_h2o[j], mcc_result_h2o[j]))
        },error=function(e){cat("ERROR :",conditionMessage(e),"\n")})
            ############################################## neuralnet
            tryCatch({
            n <- names(traindata)
            f <- as.formula(paste("num ~", paste(n[!n %in% "num"], collapse = " + ")))
            traindata_nn <- traindata
            testdata_nn <- testdata
            traindata_nn$num <- as.numeric(as.character(traindata_nn$num))
            testdata_nn$num <- as.numeric(as.character(testdata_nn$num))
            colnames(traindata_nn)
            str(traindata_nn)
            set.seed(2023)
            #traindata_nn[, -ncol(traindata_nn)] <- sapply(traindata_nn[, -ncol(traindata_nn)], scale)
            nn_fit <- neuralnet(f, data = traindata_nn, linear.output = FALSE, 
                                hidden = c(ceiling(c(length(n)-1)/2),ceiling(c(length(n)-1)/3)))
            
            #plot(nn_fit)
            #?neuralnet
            ############################
            # Predict the test set probabilities
            #For classification task,return the probability of a class
            #str(testdata[, -ncol(testdata)])
            pre_auc_neuralnet <- predict(nn_fit, testdata_nn[, -ncol(testdata_nn)])
            roc_curve_nn <- roc(testdata_nn$num, pre_auc_neuralnet[,1], plot = TRUE, print.auc=TRUE)
            roc_curve_nn
            #neuralnet::compute(nn_fit, testdata[, -ncol(testdata)])$net.result
            #### auc_neuralnet
            auc_neuralnet[j] <- as.numeric(auc(roc_curve_nn))
            ####Balanced accuracy_neuralnet_method_1
            modelroc_neuralnet <- roc_curve_nn
            cutoff_neuralnet <- coords(modelroc_neuralnet, "best", ret = "threshold")$threshold[1]
            predict.results_neuralnet <- ifelse(pre_auc_neuralnet[,1] > as.numeric(cutoff_neuralnet[1]),"1","0")
            freq_default_neuralnet <- table(predict.results_neuralnet,testdata[,n_col_newdata])
            Sensitivity_neuralnet <- freq_default_neuralnet[1,1]/sum(freq_default_neuralnet[,1])
            Specificity_neuralnet <- freq_default_neuralnet[2,2]/sum(freq_default_neuralnet[,2])
            accuracy_neuralnet[j] <- mean(testdata[,n_col_newdata] == predict.results_neuralnet)
            Balanced_accuracy_neuralnet[j] <- (Sensitivity_neuralnet+Specificity_neuralnet)/2
            ###mcc
            preds_neuralnet <- as.numeric(as.character(predict.results_neuralnet))  
            actuals_neuralnet <- as.numeric(as.character(testdata$num))
            mcc_result_neuralnet[j] <- mcc(actuals_neuralnet,preds_neuralnet)
            if (auc_neuralnet[j] < 0.5) {auc_neuralnet[j] = 1 - auc_neuralnet[j]
            accuracy_neuralnet[j] <- 1- accuracy_neuralnet[j]
            Balanced_accuracy_neuralnet[j] <- 1- Balanced_accuracy_neuralnet[j]
            mcc_result_neuralnet[j] <- abs(mcc_result_neuralnet[j])}
            print(data.frame(auc_neuralnet[j], accuracy_neuralnet[j],
                             Balanced_accuracy_neuralnet[j], mcc_result_neuralnet[j]))
            },error=function(e){cat("ERROR :",conditionMessage(e),"\n")})
            ##############################################keras
            tryCatch({
            #c(ceiling(c(ncol(traindata)-1)/3),ceiling(c(ncol(traindata)-1)/4))
            model <- keras_model_sequential() 
            model %>% 
              layer_dense(units = ceiling(c(ncol(traindata)-1)/2), activation = 'relu', input_shape = ncol(traindata)-1) %>% 
              layer_dropout(rate = 0.4) %>% 
              layer_dense(units = ceiling(c(ncol(traindata)-1)/3), activation = 'relu') %>%
              layer_dropout(rate = 0.3) %>%
              #layer_dense(units = 64, activation = 'relu') %>% 
              #layer_dropout(rate = 0.2) %>% 
              layer_dense(units = 1, activation = 'sigmoid')
            ################################Before fitting the model, we compile it specifying the type of loss function, 
            #the optimizer and the metric used for evaluating performance.
            model %>% compile(
              loss = 'binary_crossentropy',
              optimizer = "adam",
              metrics = c('AUC'))
            summary(model)
            ################################We use fit to estimate network parameters.
            str(traindata)
            traindata_keras <- traindata
            testdata_keras <- testdata
            traindata_keras$num <- as.numeric(as.character(traindata_keras$num))
            testdata_keras$num <- as.numeric(as.character(testdata_keras$num))
            str(traindata_keras)
            
            history <- model %>% fit(
              x = as.matrix(traindata_keras[, -ncol(traindata_keras)]),
              y = as.matrix(traindata_keras[, ncol(traindata_keras)]),
              epochs = 20, 
              batch_size = 32,
              validation_split = 0.2,
              verbose=0)
            plot(history)
            #############################Evaluate the model’s performance on the test data:
            model %>% evaluate(as.matrix(traindata_keras[, -ncol(traindata_keras)]), 
                               as.matrix(traindata_keras[, ncol(traindata_keras)]), batch_size=32)
            model %>% evaluate(as.matrix(testdata_keras[, -ncol(testdata_keras)]), 
                               as.matrix(testdata_keras[, ncol(testdata_keras)]), batch_size=32) #0.7960
            ############################
            # Predict the test set probabilities
            #print(auc_keras)
            #### auc_keras
            pre_auc_keras <- predict(model, as.matrix(testdata_keras[, -ncol(testdata_keras)]), type = "prob")
            pred_auc_keras <- prediction(pre_auc_keras[,1],testdata_keras[,n_col_newdata])
            auc_keras[j] <- performance(pred_auc_keras,"auc")@y.values[[1]]
            ####Balanced accuracy_keras_method_1
            modelroc_keras <- pROC::roc(testdata_keras[,n_col_newdata],as.numeric(pre_auc_keras[,1]))
            cutoff_keras <- coords(modelroc_keras, "best", ret = "threshold")$threshold[1]
            predict.results_keras <- ifelse(pre_auc_keras[,1] > as.numeric(cutoff_keras[1]),"1","0")
            freq_default_keras <- table(predict.results_keras,testdata[,n_col_newdata])
            Sensitivity_keras <- freq_default_keras[1,1]/sum(freq_default_keras[,1])
            Specificity_keras <- freq_default_keras[2,2]/sum(freq_default_keras[,2])
            accuracy_keras[j] <- mean(testdata[,n_col_newdata] == predict.results_keras)
            Balanced_accuracy_keras[j] <- (Sensitivity_keras+Specificity_keras)/2
            ###mcc
            preds_keras <- as.numeric(as.character(predict.results_keras))  
            actuals_keras <- as.numeric(as.character(testdata$num))
            mcc_result_keras[j] <- mcc(actuals_keras,preds_keras)
            ##
            if (auc_keras[j] < 0.5) {auc_keras[j] = 1 - auc_keras[j]
            accuracy_keras[j] <- 1- accuracy_keras[j]
            Balanced_accuracy_keras[j] <- 1- Balanced_accuracy_keras[j]
            mcc_result_keras[j] <- abs(mcc_result_keras[j])}
            print(data.frame(auc_keras[j], accuracy_keras[j],
                             Balanced_accuracy_keras[j], mcc_result_keras[j]))
          },error=function(e){cat("ERROR :",conditionMessage(e),"\n")})
        }
      ####################################output data 
      #####deepnet
      output_deepnet <- data.frame(mean(auc_deepnet[auc_deepnet != 0]),sd(auc_deepnet[auc_deepnet != 0]),
                              mean(accuracy_deepnet[accuracy_deepnet != 0]),sd(accuracy_deepnet[accuracy_deepnet != 0]),
                              mean(Balanced_accuracy_deepnet[Balanced_accuracy_deepnet != 0]),sd(Balanced_accuracy_deepnet[Balanced_accuracy_deepnet != 0]),
                              mean(mcc_result_deepnet[mcc_result_deepnet != 0]),sd(mcc_result_deepnet[mcc_result_deepnet != 0]))
      file_name_data_deepnet <- paste0(dir_path_target[nn],"\\","deepnet_test","\\","deepnet_test_",names(object_file_list)[[mm]])
      write.csv(output_deepnet,file_name_data_deepnet)
      #####h2o
      output_h2o <- data.frame(mean(auc_h2o[auc_h2o != 0]),sd(auc_h2o[auc_h2o != 0]),
                               mean(accuracy_h2o[accuracy_h2o != 0]),sd(accuracy_h2o[accuracy_h2o != 0]),
                               mean(Balanced_accuracy_h2o[Balanced_accuracy_h2o != 0]),sd(Balanced_accuracy_h2o[Balanced_accuracy_h2o != 0]),
                               mean(mcc_result_h2o[mcc_result_h2o != 0]),sd(mcc_result_h2o[mcc_result_h2o != 0]))
      file_name_data_h2o <- paste0(dir_path_target[nn],"\\","h2o_test","\\","h2o_test_",names(object_file_list)[[mm]])
      write.csv(output_h2o,file_name_data_h2o)
      #####neuralnet
      output_neuralnet <- data.frame(mean(auc_neuralnet[auc_neuralnet != 0]),sd(auc_neuralnet[auc_neuralnet != 0]),
                              mean(accuracy_neuralnet[accuracy_neuralnet != 0]),sd(accuracy_neuralnet[accuracy_neuralnet != 0]),
                              mean(Balanced_accuracy_neuralnet[Balanced_accuracy_neuralnet != 0]),sd(Balanced_accuracy_neuralnet[Balanced_accuracy_neuralnet != 0]),
                              mean(mcc_result_neuralnet[mcc_result_neuralnet != 0]),sd(mcc_result_neuralnet[mcc_result_neuralnet != 0]))
      file_name_data_neuralnet <- paste0(dir_path_target[nn],"\\","neuralnet_test","\\","neuralnet_test_",names(object_file_list)[[mm]])
      write.csv(output_neuralnet,file_name_data_neuralnet)
      #####keras
      output_keras <- data.frame(mean(auc_keras[auc_keras != 0]),sd(auc_keras[auc_keras != 0]),
                                mean(accuracy_keras[accuracy_keras != 0]),sd(accuracy_keras[accuracy_keras != 0]),
                                mean(Balanced_accuracy_keras[Balanced_accuracy_keras != 0]),sd(Balanced_accuracy_keras[Balanced_accuracy_keras != 0]),
                                mean(mcc_result_keras[mcc_result_keras != 0]),sd(mcc_result_keras[mcc_result_keras != 0]))
      file_name_data_keras <- paste0(dir_path_target[nn],"\\","keras_test","\\","keras_test_",names(object_file_list)[[mm]])
      write.csv(output_keras,file_name_data_keras)  
    }
  },error=function(e){cat("ERROR :",conditionMessage(e),"\n")})
}
#sink()

}
## 'data.frame':    929 obs. of  22 variables:
##  $ Mapping.ID                                  : chr  "AAKJLRGGTJKAMG" "AAOVKJBEBIDNHE" "ABJKWBDEJIDSJZ" "ACGDKVXYNVEAGU" ...
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 0 1 0 0 0 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  1 1 0 0 0 1 1 1 1 1 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 1 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 0 0 1 1 1 1 1 0 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 1 1 0 1 0 1 1 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  1 1 0 0 0 1 1 0 0 1 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  0 1 1 0 0 0 1 1 0 1 ...
##  $ tox21.ahr.p1_ratio                          : num  1 0 0 0 1 0 0 0 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  1 1 0 0 1 1 0 0 1 1 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  1 1 0 0 0 0 0 1 1 0 ...
##  $ tox21.are.bla.p1_ch2                        : num  1 0 0 0 1 1 0 1 0 1 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  1 0 0 0 0 1 0 0 1 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  1 0 0 1 0 0 0 0 0 0 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 1 0 1 1 0 0 0 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 0 0 0 0 0 1 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 0 1 1 0 1 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  1 1 0 0 0 1 0 0 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 1 0 1 1 0 0 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  0 1 1 1 1 1 1 0 1 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 1 0 0 0 0 0 1 1 ...
##  $ num                                         : Factor w/ 2 levels "0","1": 2 1 2 1 2 2 2 2 2 2 ...
## NULL
##       Mapping.ID tox21.mitotox.p1_ratio tox21.adrb2.agonist.p1_ratio.curve.rank
## 1 AAKJLRGGTJKAMG                      1                                       1
## 2 AAOVKJBEBIDNHE                      0                                       1
## 3 ABJKWBDEJIDSJZ                      1                                       0
##   tox21.erb.bla.p1_ch2 tox21.gr.hela.bla.antagonist.p1_ch2
## 1                    0                                   0
## 2                    1                                   1
## 3                    0                                   0
##   tox21.p450.2c9.p1_ratio.curve.rank tox21.chrm1.p1_antagonist.curve.rank
## 1                                  1                                    1
## 2                                  1                                    1
## 3                                  1                                    0
##   tox21.p450.1a2.p1_ratio.curve.rank tox21.ahr.p1_ratio
## 1                                  0                  1
## 2                                  1                  0
## 3                                  1                  0
##   tox21.adrb2.agonist.p1_ch1.curve.rank tox21.ppard.bla.antagonist.p1_ch2
## 1                                     1                                 1
## 2                                     1                                 1
## 3                                     0                                 0
##   tox21.are.bla.p1_ch2 tox21.vdr.bla.antagonist.p1_ch2
## 1                    1                               1
## 2                    0                               0
## 3                    0                               0
##   tox21.mitotox.p1_rhodamine tox21.shh.3t3.gli3.antagonist.p1_ratio
## 1                          1                                      1
## 2                          0                                      1
## 3                          0                                      1
##   tox21.kiss1r.hek293.p2_antagonist.curve.rank
## 1                                            0
## 2                                            0
## 3                                            0
##   tox21.er.luc.bg1.4e2.agonist.p2_ratio tox21.p450.3a4.p1_ratio.curve.rank
## 1                                     0                                  1
## 2                                     1                                  1
## 3                                     0                                  0
##   tox21.gnrhr.hek293.p2_antagonist.curve.rank tox21.pparg.bla.antagonist.p1_ch2
## 1                                           1                                 0
## 2                                           1                                 1
## 3                                           1                                 1
##   tox21.htr2a.p1_antagonist.curve.rank num
## 1                                    1   1
## 2                                    0   0
## 3                                    1   1
## [1] 929  22
##  [1] "Mapping.ID"                                  
##  [2] "tox21.mitotox.p1_ratio"                      
##  [3] "tox21.adrb2.agonist.p1_ratio.curve.rank"     
##  [4] "tox21.erb.bla.p1_ch2"                        
##  [5] "tox21.gr.hela.bla.antagonist.p1_ch2"         
##  [6] "tox21.p450.2c9.p1_ratio.curve.rank"          
##  [7] "tox21.chrm1.p1_antagonist.curve.rank"        
##  [8] "tox21.p450.1a2.p1_ratio.curve.rank"          
##  [9] "tox21.ahr.p1_ratio"                          
## [10] "tox21.adrb2.agonist.p1_ch1.curve.rank"       
## [11] "tox21.ppard.bla.antagonist.p1_ch2"           
## [12] "tox21.are.bla.p1_ch2"                        
## [13] "tox21.vdr.bla.antagonist.p1_ch2"             
## [14] "tox21.mitotox.p1_rhodamine"                  
## [15] "tox21.shh.3t3.gli3.antagonist.p1_ratio"      
## [16] "tox21.kiss1r.hek293.p2_antagonist.curve.rank"
## [17] "tox21.er.luc.bg1.4e2.agonist.p2_ratio"       
## [18] "tox21.p450.3a4.p1_ratio.curve.rank"          
## [19] "tox21.gnrhr.hek293.p2_antagonist.curve.rank" 
## [20] "tox21.pparg.bla.antagonist.p1_ch2"           
## [21] "tox21.htr2a.p1_antagonist.curve.rank"        
## [22] "num"
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##   auc_deepnet.j. accuracy_deepnet.j. Balanced_accuracy_deepnet.j.
## 1       0.567569           0.5683453                    0.5683453
##   mcc_result_deepnet.j.
## 1             0.1387749
##  Connection successful!
## 
## R is connected to the H2O cluster: 
##     H2O cluster uptime:         55 minutes 49 seconds 
##     H2O cluster timezone:       America/New_York 
##     H2O data parsing timezone:  UTC 
##     H2O cluster version:        3.40.0.1 
##     H2O cluster version age:    2 months and 17 days 
##     H2O cluster name:           H2O_started_from_R_xut2_nzr889 
##     H2O cluster total nodes:    1 
##     H2O cluster total memory:   0.94 GB 
##     H2O cluster total cores:    20 
##     H2O cluster allowed cores:  20 
##     H2O cluster healthy:        TRUE 
##     H2O Connection ip:          localhost 
##     H2O Connection port:        54321 
##     H2O Connection proxy:       NA 
##     H2O Internal Security:      FALSE 
##     R Version:                  R version 4.2.2 (2022-10-31 ucrt) 
## 
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## Setting levels: control = 0, case = 1
## Setting direction: controls > cases
##   auc_h2o.j. accuracy_h2o.j. Balanced_accuracy_h2o.j. mcc_result_h2o.j.
## 1  0.5190725       0.4496403                0.4496403         0.1499923
## 'data.frame':    642 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 0 0 0 1 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  1 1 0 0 1 1 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 1 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 0 1 1 1 1 1 0 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 1 1 1 0 1 1 0 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  1 1 0 0 1 1 0 0 1 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  0 1 1 0 0 1 1 0 1 0 ...
##  $ tox21.ahr.p1_ratio                          : num  1 0 0 1 0 0 0 0 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  1 1 0 1 1 0 0 1 1 1 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  1 1 0 0 0 0 1 1 0 1 ...
##  $ tox21.are.bla.p1_ch2                        : num  1 0 0 1 1 0 1 0 1 0 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  1 0 0 0 0 0 0 0 0 1 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 1 1 0 0 0 1 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 0 0 0 0 1 1 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 1 0 1 0 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  1 1 0 0 1 0 0 0 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 0 0 1 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  0 1 1 1 1 1 0 1 0 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 1 0 0 0 0 1 1 0 ...
##  $ num                                         : num  1 0 1 1 1 1 1 1 1 0 ...
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases

##   auc_neuralnet.j. accuracy_neuralnet.j. Balanced_accuracy_neuralnet.j.
## 1        0.5293981             0.5539568                      0.5539568
##   mcc_result_neuralnet.j.
## 1               0.1205724
## Model: "sequential"
## ________________________________________________________________________________
##  Layer (type)                       Output Shape                    Param #     
## ================================================================================
##  dense_2 (Dense)                    (None, 10)                      210         
##  dropout_1 (Dropout)                (None, 10)                      0           
##  dense_1 (Dense)                    (None, 7)                       77          
##  dropout (Dropout)                  (None, 7)                       0           
##  dense (Dense)                      (None, 1)                       8           
## ================================================================================
## Total params: 295
## Trainable params: 295
## Non-trainable params: 0
## ________________________________________________________________________________
## 'data.frame':    642 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 0 0 0 1 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  1 1 0 0 1 1 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 1 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 0 1 1 1 1 1 0 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 1 1 1 0 1 1 0 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  1 1 0 0 1 1 0 0 1 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  0 1 1 0 0 1 1 0 1 0 ...
##  $ tox21.ahr.p1_ratio                          : num  1 0 0 1 0 0 0 0 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  1 1 0 1 1 0 0 1 1 1 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  1 1 0 0 0 0 1 1 0 1 ...
##  $ tox21.are.bla.p1_ch2                        : num  1 0 0 1 1 0 1 0 1 0 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  1 0 0 0 0 0 0 0 0 1 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 1 1 0 0 0 1 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 0 0 0 0 1 1 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 1 0 1 0 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  1 1 0 0 1 0 0 0 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 0 0 1 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  0 1 1 1 1 1 0 1 0 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 1 0 0 0 0 1 1 0 ...
##  $ num                                         : Factor w/ 2 levels "0","1": 2 1 2 2 2 2 2 2 2 1 ...
## 'data.frame':    642 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 0 0 0 1 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  1 1 0 0 1 1 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 1 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 0 1 1 1 1 1 0 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 1 1 1 0 1 1 0 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  1 1 0 0 1 1 0 0 1 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  0 1 1 0 0 1 1 0 1 0 ...
##  $ tox21.ahr.p1_ratio                          : num  1 0 0 1 0 0 0 0 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  1 1 0 1 1 0 0 1 1 1 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  1 1 0 0 0 0 1 1 0 1 ...
##  $ tox21.are.bla.p1_ch2                        : num  1 0 0 1 1 0 1 0 1 0 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  1 0 0 0 0 0 0 0 0 1 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 1 1 0 0 0 1 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 0 0 0 0 1 1 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 1 0 1 0 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  1 1 0 0 1 0 0 0 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 0 0 1 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  0 1 1 1 1 1 0 1 0 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 1 0 0 0 0 1 1 0 ...
##  $ num                                         : num  1 0 1 1 1 1 1 1 1 0 ...
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##   auc_keras.j. accuracy_keras.j. Balanced_accuracy_keras.j. mcc_result_keras.j.
## 1    0.5583044         0.5611511                  0.5611511           0.1223528
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
##   auc_deepnet.j. accuracy_deepnet.j. Balanced_accuracy_deepnet.j.
## 1      0.5177277           0.5395683                    0.5415631
##   mcc_result_deepnet.j.
## 1            0.09984338
##  Connection successful!
## 
## R is connected to the H2O cluster: 
##     H2O cluster uptime:         56 minutes 51 seconds 
##     H2O cluster timezone:       America/New_York 
##     H2O data parsing timezone:  UTC 
##     H2O cluster version:        3.40.0.1 
##     H2O cluster version age:    2 months and 17 days 
##     H2O cluster name:           H2O_started_from_R_xut2_nzr889 
##     H2O cluster total nodes:    1 
##     H2O cluster total memory:   0.20 GB 
##     H2O cluster total cores:    20 
##     H2O cluster allowed cores:  20 
##     H2O cluster healthy:        TRUE 
##     H2O Connection ip:          localhost 
##     H2O Connection port:        54321 
##     H2O Connection proxy:       NA 
##     H2O Internal Security:      FALSE 
##     R Version:                  R version 4.2.2 (2022-10-31 ucrt) 
## 
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases

##   auc_h2o.j. accuracy_h2o.j. Balanced_accuracy_h2o.j. mcc_result_h2o.j.
## 1  0.5107919       0.5359712                0.5348344        0.07344363
## 'data.frame':    643 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 1 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  0 1 1 1 1 0 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 1 1 0 0 1 1 1 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 0 1 1 0 0 1 1 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  0 1 1 0 1 0 0 1 0 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  1 0 1 1 1 0 1 1 0 1 ...
##  $ tox21.ahr.p1_ratio                          : num  0 0 0 0 0 0 0 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  0 1 0 0 1 0 1 1 1 0 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  0 0 0 1 0 0 1 1 1 0 ...
##  $ tox21.are.bla.p1_ch2                        : num  0 1 0 1 1 0 1 1 0 1 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  0 1 0 0 0 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  0 0 0 0 0 1 0 1 0 0 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 0 1 1 1 1 0 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 1 0 1 0 0 0 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 0 0 0 1 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  0 1 0 0 0 1 1 1 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 1 1 0 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  1 1 1 0 0 0 1 0 1 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ num                                         : num  1 1 1 1 1 1 1 1 0 0 ...
## Warning: Algorithm did not converge in 1 of 1 repetition(s) within the stepmax.
## ERROR : requires numeric/complex matrix/vector arguments 
## Model: "sequential_1"
## ________________________________________________________________________________
##  Layer (type)                       Output Shape                    Param #     
## ================================================================================
##  dense_5 (Dense)                    (None, 10)                      210         
##  dropout_3 (Dropout)                (None, 10)                      0           
##  dense_4 (Dense)                    (None, 7)                       77          
##  dropout_2 (Dropout)                (None, 7)                       0           
##  dense_3 (Dense)                    (None, 1)                       8           
## ================================================================================
## Total params: 295
## Trainable params: 295
## Non-trainable params: 0
## ________________________________________________________________________________
## 'data.frame':    643 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 1 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  0 1 1 1 1 0 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 1 1 0 0 1 1 1 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 0 1 1 0 0 1 1 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  0 1 1 0 1 0 0 1 0 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  1 0 1 1 1 0 1 1 0 1 ...
##  $ tox21.ahr.p1_ratio                          : num  0 0 0 0 0 0 0 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  0 1 0 0 1 0 1 1 1 0 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  0 0 0 1 0 0 1 1 1 0 ...
##  $ tox21.are.bla.p1_ch2                        : num  0 1 0 1 1 0 1 1 0 1 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  0 1 0 0 0 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  0 0 0 0 0 1 0 1 0 0 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 0 1 1 1 1 0 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 1 0 1 0 0 0 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 0 0 0 1 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  0 1 0 0 0 1 1 1 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 1 1 0 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  1 1 1 0 0 0 1 0 1 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ num                                         : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 1 1 ...
## 'data.frame':    643 obs. of  21 variables:
##  $ tox21.mitotox.p1_ratio                      : num  1 0 1 0 0 1 1 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ratio.curve.rank     : num  0 1 1 1 1 0 1 1 1 0 ...
##  $ tox21.erb.bla.p1_ch2                        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ tox21.gr.hela.bla.antagonist.p1_ch2         : num  0 1 1 1 0 0 1 1 1 1 ...
##  $ tox21.p450.2c9.p1_ratio.curve.rank          : num  1 0 1 1 0 0 1 1 0 0 ...
##  $ tox21.chrm1.p1_antagonist.curve.rank        : num  0 1 1 0 1 0 0 1 0 0 ...
##  $ tox21.p450.1a2.p1_ratio.curve.rank          : num  1 0 1 1 1 0 1 1 0 1 ...
##  $ tox21.ahr.p1_ratio                          : num  0 0 0 0 0 0 0 1 0 0 ...
##  $ tox21.adrb2.agonist.p1_ch1.curve.rank       : num  0 1 0 0 1 0 1 1 1 0 ...
##  $ tox21.ppard.bla.antagonist.p1_ch2           : num  0 0 0 1 0 0 1 1 1 0 ...
##  $ tox21.are.bla.p1_ch2                        : num  0 1 0 1 1 0 1 1 0 1 ...
##  $ tox21.vdr.bla.antagonist.p1_ch2             : num  0 1 0 0 0 0 0 1 0 0 ...
##  $ tox21.mitotox.p1_rhodamine                  : num  0 0 0 0 0 1 0 1 0 0 ...
##  $ tox21.shh.3t3.gli3.antagonist.p1_ratio      : num  1 1 1 0 0 1 1 1 1 0 ...
##  $ tox21.kiss1r.hek293.p2_antagonist.curve.rank: num  0 0 0 0 1 0 1 0 0 0 ...
##  $ tox21.er.luc.bg1.4e2.agonist.p2_ratio       : num  0 1 0 1 0 0 0 1 0 0 ...
##  $ tox21.p450.3a4.p1_ratio.curve.rank          : num  0 1 0 0 0 1 1 1 0 0 ...
##  $ tox21.gnrhr.hek293.p2_antagonist.curve.rank : num  1 1 1 0 1 1 1 1 0 1 ...
##  $ tox21.pparg.bla.antagonist.p1_ch2           : num  1 1 1 0 0 0 1 0 1 0 ...
##  $ tox21.htr2a.p1_antagonist.curve.rank        : num  1 0 0 0 1 0 0 1 0 0 ...
##  $ num                                         : num  1 1 1 1 1 1 1 1 0 0 ...
## Setting levels: control = 0, case = 1
## Setting direction: controls > cases

##   auc_keras.j. accuracy_keras.j. Balanced_accuracy_keras.j. mcc_result_keras.j.
## 1    0.5114648         0.5395683                  0.5375776          0.09026935