【发布时间】:2018-06-29 21:32:10
【问题描述】:
随着我的输入不断涌现,我想对我的神经网络进行持续训练。但是,当我获得新数据时,标准化值会随着时间而变化。假设我及时得到:
df <- "Factor1 Factor2 Factor3 Response
10 10000 0.4 99
15 10200 0 88
11 9200 1 99
13 10300 0.3 120"
df <- read.table(text=df, header=TRUE)
normalize <- function(x) {
return ((x - min(x)) / (max(x) - min(x)))
}
dfNorm <- as.data.frame(lapply(df, normalize))
### Keep old normalized values
dfNormOld <- dfNorm
library(neuralnet)
nn <- neuralnet(Response~Factor1+Factor2+Factor3, data=dfNorm, hidden=c(3,4),
linear.output=FALSE, threshold=0.10, lifesign="full", stepmax=20000)
那么,随着时间二的到来:
df2 <- "Factor1 Factor2 Factor3 Response
12 10100 0.2 101
14 10900 -0.7 108
11 9800 0.8 120
11 10300 0.3 113"
df2 <- read.table(text=df2, header=TRUE)
### Bind all-time data
df <- rbind(df2, df)
### Normalize all-time data in one shot
dfNorm <- as.data.frame(lapply(df, normalize))
### Continue training the network with most recent data
library(neuralnet)
Wei <- nn$weights
nn <- neuralnet(Response~Factor1+Factor2+Factor3, data=df[1:nrow(df2),], hidden=c(3,4),
linear.output=FALSE, threshold=0.10, lifesign="full", stepmax=20000, startweights = Wei)
这将是我随着时间的推移训练它的方式。但是,我想知道是否有任何优雅的方法可以减少这种持续训练的偏差,因为标准化值会随着时间的推移不可避免地发生变化。在这里,我假设非标准化值可能存在偏差。
【问题讨论】:
-
如果非归一化值有偏差,归一化值也会有偏差。您不会通过更改值的比例来消除偏见。
-
一种解决方案可能是对每个变量使用通用的最小值和最大值,并始终使用它们进行标准化。它可能接近您期望的最大和最小测量值(?)。当然,这取决于变量的性质。
标签: r neural-network normalization training-data