首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >R中预测的PreProcessing标度-预测的标度不同

R中预测的PreProcessing标度-预测的标度不同
EN

Stack Overflow用户
提问于 2016-11-03 02:26:16
回答 1查看 628关注 0票数 0

我正在使用插入符号包中的训练函数在R中训练神经网络。我在这里使用了一些示例代码:Time-series - data spliting and model evaluation

网络训练的输出告诉我它已经被重新缩放到0,1,但是当我使用预测函数时,我的预测没有缩放到0,1。首先,我如何知道数据是否被正确地标准化?第二,如何获得归一化预测?

下面是我的代码:

代码语言:javascript
复制
timeSlices <- createTimeSlices(1:nrow(mytsframe3), initialWindow = 36,
                           horizon = 12, fixedWindow = TRUE)

nn <- train(diffREALBRENTSPOT ~ diffF1REALlag + diffF2REALlag, data = mytsframe3[trainSlices[[1]],], method = "mlp"
        , size = 1, preProc = c("range"))

> nn
Multi-Layer Perceptron 

36 samples
 2 predictor

Pre-processing: re-scaling to [0, 1] (2) 
Resampling: Bootstrapped (25 reps) 
Summary of sample sizes: 36, 36, 36, 36, 36, 36, ... 
Resampling results across tuning parameters:

  size  RMSE       Rsquared 
  1     0.7879697  0.2098693
  3     0.7485212  0.2249331
  5     0.7571630  0.2246444

RMSE was used to select the optimal model using  the smallest value.
The final value used for the model was size = 3. 

pred <- predict(nn, mytsframe3[testSlices[[1]],])

str(pred)
 Named num [1:12] 0.0734 -0.0214 0.3264 0.0362 -0.1569 ...
 - attr(*, "names")= chr [1:12] "37" "38" "39" "40" ...

以下是我用于测试的数据的dput

代码语言:javascript
复制
structure(list(diffREALBRENTSPOT = c(-0.523999999999999, -0.693, 
0.386999999999999, 0.453000000000001, -0.842000000000001, 0.369999999999999
), diffF1REALlag = c(0.48597655, -1.61485375, 0.60622805, -0.469351210000001, 
0.292303670000001, -0.44088176), diffF2REALlag = c(1.00948236, 
0.48597655, -1.61485375, 0.60622805, -0.469351210000001, 0.292303670000001
)), .Names = c("diffREALBRENTSPOT", "diffF1REALlag", "diffF2REALlag"
), row.names = c(NA, 6L), class = "data.frame")
EN

回答 1

Stack Overflow用户

发布于 2016-11-05 01:32:35

网络训练的输出告诉我,它已经被重新缩放到0,1,但是当我使用预测函数时,我的预测没有缩放到0,1。

结果是数值的,并且您正在拟合回归模型(而不是分类)。preProc选项将预测值重新调整为0,1,并且不会将结果或预测重新调整为在此范围内。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40387190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档