Normalization of data in continuous neural network training in R Normalization of data in continuous neural network training in R r r

Normalization of data in continuous neural network training in R


You can use this code:

normalize <- function(x,min1,max1,row1) {     if(row1>0)        x[1:row1,] = (x[1:row1,]*(max1-min1))+min1     return ((x - min(x)) / (max(x) - min(x))) }past_min = rep(0,dim(df)[2])past_max = rep(0,dim(df)[2])rowCount = 0while(1){df = mapply(normalize, x=df, min1 = past_min, max1 = past_max,row1 = rep(rowCount,dim(df)[2]))nn <- neuralnet(Response~Factor1+Factor2+Factor3, data=dfNorm, hidden=c(3,4),                     linear.output=FALSE, threshold=0.10,  lifesign="full", stepmax=20000)past_min = as.data.frame(lapply(df, min))past_max = as.data.frame(lapply(df, max))rowCount = dim(df)[1]df2 <- read.table(text=df2, header=TRUE)df <- rbind(df2, df)}