为什么我在Rstudio的Keras上使用Keras在训练期间打印所有这些新线?我可以以某种方式阻止它吗?我有另一台运行相同型号的机器,我没有得到这些新线。在Windows 7上运行R 3.4.1
这是代码,我打电话给TestOOS()开始培训
library('caret')
library(keras)
neural.train = function(model,XY)
{
XY <- as.matrix(XY)
X <- XY[,-ncol(XY)]
Y <- XY[,ncol(XY)]
Y <- ifelse(Y > 0,1,0)
newModel <- keras_model_sequential()
newModel %>%
layer_dense(units = 20, activation = 'relu', input_shape = c(20)) %>%
layer_dense(units = 15, activation = 'relu') %>%
layer_dense(units = 10, activation = 'relu') %>%
layer_dropout(rate = 0.2) %>%
layer_dense(units = 5, activation = 'relu') %>%
layer_dropout(rate = 0.2) %>%
layer_dense(units = 1) %>%
layer_activation('sigmoid')
newModel %>% compile(
optimizer = optimizer_sgd(lr = 0.01, momentum = 0, decay = 0, nesterov = FALSE),
loss = 'binary_crossentropy',
metrics = c('accuracy')
)
newModel %>% fit(X, Y, epochs=100, batch_size=100, validation_split = 0.2)
Models[[model]] <<- newModel
}
neural.predict = function(model,X)
{
if(is.vector(X)) X <- t(X)
classes <- model %>% predict_classes(X)
#return(nn.predict(Models[[model]],X))
}
neural.init = function()
{
set.seed(365)
Models <<- vector("list")
}
TestOOS = function()
{
neural.init()
XY <<- read.csv('C:/Users/BL-Kyl/Zorro/Data/DeepSignalsEURUSD_L.csv',header = F)
splits <- nrow(XY)*0.8
XY.tr <<- head(XY,splits);
XY.ts <<- tail(XY,-splits)
neural.train(2,XY.tr)
X <<- XY.ts[,-ncol(XY.ts)]
Y <<- XY.ts[,ncol(XY.ts)]
Y.ob <<- ifelse(Y > 0,1,0)
Y <<- neural.predict(2,X)
Y.pr <<- ifelse(Y > 0.5,1,0)
confusionMatrix(Y.pr,Y.ob)
}
并产生此输出
Using TensorFlow backend.
Train on 95666 samples, validate on 23917 samples
Epoch 1/100
8
15
2
2
3
....
Another 100 lines or so
...
63
64
65
66100/95666 [===================>..........]
- ETA: 2s - loss: 0.6886 - acc: 0.5411
如果最后两行的前几位数字发生变化,则看起来会打印一个新行
编辑:创建一个gif来显示问题http://imgur.com/a/Evwl7