library(tidyverse)
library(ggplot2)
library(caret)
varImp(fullFit, scale = FALSE)
plot(varImp(fullFit, scale = FALSE))
> varImp(fullFit, scale = FALSE)
Overall
bedrooms 2.9003032
bathrooms 1.9974678
sqft_living 13.5250547
sqft_lot 0.7873693
floors 2.2513678
waterfront 11.2258728
sqft_above 3.4476093
sqft_living15 6.4453136
sqft_lot15 1.9466399
当我尝试绘制VarImp时,它不会绘制变量(卧室,浴室等)。创建从插入符号包中绘制变量重要性的可视化效果的正确方法是什么?
plot(varImp(fullFit, scale = FALSE))
答案 0 :(得分:0)
set.seed(23)
library(caret)
library(mlbench)
data(Sonar)
traincontrol <- trainControl(method = "cv", number = 5, returnResamp = "all", savePredictions='all', classProbs = TRUE, summaryFunction = twoClassSummary)
nnet_model <- train(Class ~.,
data = Sonar,
method = "nnet",
trControl = traincontrol,
metric = "ROC",
trace = FALSE)
plot(varImp(nnet_model$finalModel, scale = FALSE))#wrong image
plot(varImp(nnet_model, scale = FALSE))#correct image