我从Brett Lantz的教科书“Machine Learning With R”中取出了以下代码,但是从教科书中将其完全复制到控制台,
Route::auth();
Route::group(['middleware' => 'auth'], function () {
Route::post('entity/process', 'EntityController@process');
Route::get('entity/form/{subCategoryID}/{id?}', 'EntityController@viewForm');
Route::get('entity/delete/{id}', 'EntityController@delete');
Route::get('/viewList/{masterCategoryID}/{subCategoryID}', 'EntityController@viewList');
Route::get('/viewCategories', 'MasterCategoryController@viewAll');
Route::get('/', 'MasterCategoryController@viewAll');
});
我收到了这个回复。怎么了?
> library(caret)
Loading required package: lattice
Loading required package: ggplot2
> library(kernlab)
Attaching package: ‘kernlab’
The following object is masked from ‘package:ggplot2’:
alpha
> set.seed(300)
> ctrl <- trainControl(method = "cv", number = 10)
> bagctrl <- bagControl(fit = svmBag$fit, predict = svmBag$pred, aggregate = svmBag$aggregate)
> setwd("~/2148OS_code/chapter 11")
> credit <- read.csv("credit.csv")
> svmbag <- train(default ~ ., data = credit, "bag", trControl = ctrl, bagControl = bagctrl)
警告是
Something is wrong; all the Accuracy metric values are missing:
Accuracy Kappa
Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA
Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA
NA's :1 NA's :1
Error in train.default(x, y, weights = w, ...) : Stopping
In addition: There were 50 or more warnings (use warnings() to see the first 50)
答案 0 :(得分:1)
之前我遇到过同样的问题。问题出现在类变量值中。
请尝试将类值从“0”,“1”更改为例如“A”,“B”并尝试相同的代码。
答案 1 :(得分:1)
我使用了第二版打包提供的代码。
如果设置并行处理,警告将消失。您仍然会得到缺少准确度指标的错误。
此错误是由重采样性能度量中缺少值的事实引起的。如果存在重新采样,其中一个结果类(在这种情况下是默认值)的样本为零,那么可能会发生这种情况,因此未定义敏感性或特异性。
我还使用插入符包中包含的GermanCredit数据运行测试,这会产生相同的错误。