【问题标题】:Feature scaling in RR中的特征缩放
【发布时间】:2017-09-04 22:06:06
【问题描述】:

我想使用 caret 包扩展我的功能 我的数据集是 train[,1:10]: 自变量 train[11]: 是我的因变量

我使用下面的代码来缩放我的 10 个自变量:

library(caret)
# calculate the pre-process parameters from the dataset
preprocessParams <- preProcess(train[,1:10], method = "range")
# transform the dataset using the parameters
train_Scaled <-predict(pp, train[,1:10])
# summarize the transformed dataset
summary(train_Scaled)

因此,我的 train_Scaled 数据框将缩放 10 个我想要的自变量,但不再具有因变量。如何将我的因变量附加到我的新 train_Scaled 数据框?谢谢!

【问题讨论】:

    标签: r dataframe scaling r-caret


    【解决方案1】:
    cbind(train_Scaled, train[,11])
    

    【讨论】:

      猜你喜欢
      • 2020-05-31
      • 1970-01-01
      • 2020-04-21
      • 2021-06-22
      • 2019-12-21
      • 1970-01-01
      • 2020-09-24
      • 2019-03-21
      • 2020-11-23
      相关资源
      最近更新 更多