运行library(caret) library(neuralnet) data <- read.csv("housing_renamed.csv") data$year_built[is.na(data$year_built)] <- median(data$year_built, na.rm = TRUE) predictors <- subset(data, select = -c(value_per_sq_ft)) response <- data$value_per_sq_ft ctrl <- trainControl(method = "cv", number = 3) model1 <- train(response ~ ., data = predictors, method = "neuralnet", trControl = ctrl) model2 <- train(response ~ ., data = predictors, method = "neuralnet", trControl = ctrl) print(model1) print(model2)出现Something is wrong; all the RMSE metric values are missing:报错
时间: 2024-01-21 20:04:19 浏览: 160
Learning-Data-Mining-with-R.zip_R 机器学习_data mining R code_data m
这个错误可能是由于数据中存在缺失值导致的。你需要检查数据中是否存在其他缺失值,并对其进行处理。另外,你可以尝试在train函数中添加一个参数preProcess,将其设置为"impute",以对缺失值进行处理。例如:
```
model1 <- train(response ~ ., data = predictors, method = "neuralnet",
trControl = ctrl, preProcess = "impute")
```
你可以尝试这个方法来解决这个错误。
阅读全文