How to use predict with nnet in R

0

I have the following question:

I'm making a neural network with nnet in R.

  library(RODBC)

  library(nnet)

  library(neuralnet)

  library(devtools)

  library(reshape2)

  library(readxl)

  library(dplyr)

  library(reshape)

  library(readxl)



source('C:nnet_plot_update.r')

datos <- read_xlsx("Dataset.xlsx", sheet=1)

input <- select(datos, -EMR)
output <- select(datos, EMR)

net <- neuralnet(EMR ~ TC241.1 + TC221.1 + TI221.6 + TI222.3 + PC221.3 + PC225.4 + LC221.2 + LI222.2 + CALC.16 + CALC.22, datos, hidden =c(6), threshold=0.01)

plot(net)

test <- read_xlsx("Dataset.xlsx", sheet=4)

test1 <- read_xlsx("Dataset.xlsx", sheet=3)


prediccion <- neuralnet::compute(net,test)

results <- data.frame(actual = test1$EMR , prediccion = prediccion$net.result)

results <- format(round(results, 2))

print(results)



test2 <-  data.frame(200.78,263.9,221.27,221,197.06,4.97,24.94,16.62,74.92,8000.0)


prediccionnn <- neuralnet::compute(net,test2)

results <- data.frame(prediccion = prediccionnn$net.result)

results <- format(round(results, 2))

print(results)

This would be the complete code

    
asked by Andres 12.11.2018 в 05:26
source

0 answers