В R я попытался запустить код (проблема повышения / регрессии градиента): пакет каретки, функция train ().
control <- trainControl (method = "cv", number = 10) gbgrid <- expand.grid (n.trees = (2:10) * 50, усадка = c (0.01,0.05), взаимодействие.depth = c (2,3)) </p>
metri c <- "RMSE" </p>
gb_model1 <- train (SalePrice ~., data = as.data.frame (train1), distribution = "gaussian", method = "gbm", trContol = control, tuneGrid = gbgrid, метрика = metri c, allowParallel = TRUE) </p>
[data]
train1: data.frame,
SalePrice: 12.223 , 11.536, 11.886, ... (цифра c)
но существует множество ошибок , подобных этому
model fit failed for Resample01: shrinkage=0.01, interaction.depth=2, n.minobsinnode=10, n.trees=500 Error in (function (x, y, offset = NULL, misc = NULL, distribution = "bernoulli", :
unused arguments (trContol = list("cv", 10, NA, "grid", 0.75, NULL, 1, TRUE, 0, FALSE, TRUE, "final", FALSE, FALSE, function (data, lev = NULL, model = NULL)
{
if (is.character(data$obs)) data$obs <- factor(data$obs, levels = lev)
postResample(data[, "pred"], data[, "obs"])
}, "best", list(0.95, 3, 5, 19, 10, 0.9), NULL, NULL, NULL, NULL, 0, c(FALSE, FALSE), NA, list(5, 0.05, "gls", TRUE), FALSE, TRUE), allowParallel = TRUE)
model fit failed for Resample01: shrinkage=0.01, interaction.depth=3, n.minobsinnode=10, n.trees=500 Error in (function (x, y, offset = NULL, misc = NULL, distribution = "bernoulli", :
unused arguments (trContol = list("cv", 10, NA, "grid", 0.75, NULL, 1, TRUE, 0, FALSE, TRUE, "final", FALSE, FALSE, function (data, lev = NULL, model = NULL)
{
if (is.character(data$obs)) data$obs <- factor(data$obs, levels = lev)
postResample(data[, "pred"], data[, "obs"])
}, "best", list(0.95, 3, 5, 19, 10, 0.9), NULL, NULL, NULL, NULL, 0, c(FALSE, FALSE), NA, list(5, 0.05, "gls", TRUE), FALSE, TRUE), allowParallel = TRUE)
model fit failed for Resample01: shrinkage=0.05, interaction.depth=2, n.minobsinnode=10, n.trees=500 Error in (function (x, y, offset = NULL, misc = NULL, distribution = "bernoulli", :
unused arguments (trContol = list("cv", 10, NA, "grid", 0.75, NULL, 1, TRUE, 0, FALSE, TRUE, "final", FALSE, FALSE, function (data, lev = NULL, model = NULL)
{
if (is.character(data$obs)) data$obs <- factor
...
и, наконец,
There were missing values in resampled performance measures.Something is wrong; all the RMSE metric values are missing:
RMSE Rsquared MAE
Min. : NA Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA Median : NA
Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA Max. : NA
NA's :36 NA's :36 NA's :36
Error: Stopping
У меня два вопроса
Я пытаюсь подогнать градиентное усиление (модель дерева регрессии), поэтому я определил распределение " gaussian ", а не Бернулли (дефолт). Но R автоматически использует распределение Бернулли. Поэтому я хочу исправить распределение моей модели. Как?
Почему не подходит модель? Я не знаю почему, поэтому, пожалуйста, дайте мне знать. Спасибо.
dput (dput (head (train1,5)), file = "dput")
structure(list(LotFrontage = c(-0.231086499198424, 0.467636262791003,
-0.0913419468005386, -0.463994086528233, 0.65396233265485), LotArea = c(-0.203864134597299,
-0.0872217888585377, 0.0801346202449026, -0.0922931951950055,
0.385433281700269), YearBuilt = c(1.05259827431749, 0.158373584715388,
0.986359408421036, -1.86191182512639, 0.95323997547281), MasVnrArea = c(0.523756824755934,
-0.570543597812911, 0.333929200432767, -0.570543597812911, 1.38356429963145
), BsmtFinSF1 = c(0.617071387253262, 1.24529174693922, 0.108951978683735,
-0.514649113651593, 0.499280069812144), BsmtFinSF2 = c(-0.288768170446492,
-0.288768170446492, -0.288768170446492, -0.288768170446492, -0.288768170446492
), BsmtUnfSF = c(-0.943471604093699, -0.640363973228774, -0.301064386439679,
-0.0612926784420519, -0.174392540705084), TotalBsmtSF = c(-0.47360339875667,
0.504751535224413, -0.319379960887731, -0.714577520426887, 0.222811812870259
), X1stFlrSF = c(-0.814029605450836, 0.277252373744175, -0.642004859961967,
-0.531801507383161, -0.0372303641026634), X2ndFlrSF = c(1.16722570688286,
-0.794081316713915, 1.19478505616057, 0.942157687781592, 1.62425158240483
), LowQualFinSF = c(-0.120284088068819, -0.120284088068819, -0.120284088068819,
-0.120284088068819, -0.120284088068819), GrLivArea = c(0.392878002482192,
-0.489222723052672, 0.542520089849713, 0.406660826318674, 1.35373772136838
), BsmtFullBath = c(1.11350389494382, -0.819220722708666, 1.11350389494382,
1.11350389494382, 1.11350389494382), BsmtHalfBath = c(-0.241153188316979,
3.9445771517563, -0.241153188316979, -0.241153188316979, -0.241153188316979
), FullBath = c(0.793273490644681, 0.793273490644681, 0.793273490644681,
-1.02526856809737, 0.793273490644681), HalfBath = c(1.22927692829499,
-0.759941452897126, 1.22927692829499, -0.759941452897126, 1.22927692829499
), BedroomAbvGr = c(0.163838210151874, 0.163838210151874, 0.163838210151874,
0.163838210151874, 1.38884390451819), KitchenAbvGr = c(-0.211532471464928,
-0.211532471464928, -0.211532471464928, -0.211532471464928, -0.211532471464928
), TotRmsAbvGrd = c(0.921495678822331, -0.316220304340229, -0.316220304340229,
0.302637687241051, 1.54035367040361), Fireplaces = c(-0.951904653816842,
0.605757506974354, 0.605757506974354, 0.605757506974354, 0.605757506974354
), GarageYrBlt = c(1.00894639941957, -0.0176815978806509, 0.932899881101033,
0.818830103623231, 0.894876621941766), GarageCars = c(0.313051365276902,
0.313051365276902, 0.313051365276902, 1.65155251065439, 1.65155251065439
), GarageArea = c(0.357850548470989, -0.0567758729045632, 0.640550381227048,
0.800746953122147, 1.71480974570007), WoodDeckSF = c(-0.750573166644868,
1.62676987499194, -0.750573166644868, -0.750573166644868, 0.781137786356027
), OpenPorchSF = c(0.225904085900411, -0.708061030862827, -0.0650030816160072,
-0.172179406490477, 0.578054867630813), EnclosedPorch = c(-0.359479771017892,
-0.359479771017892, -0.359479771017892, 4.08818658380666, -0.359479771017892
), X3SsnPorch = c(-0.116380201854229, -0.116380201854229, -0.116380201854229,
-0.116380201854229, -0.116380201854229), ScreenPorch = c(-0.270314412222425,
-0.270314412222425, -0.270314412222425, -0.270314412222425, -0.270314412222425
), PoolArea = c(-0.0636868332301633, -0.0636868332301633, -0.0636868332301633,
-0.0636868332301633, -0.0636868332301633), MiscVal = c(-0.0877182990003638,
-0.0877182990003638, -0.0877182990003638, -0.0877182990003638,
-0.0877182990003638), SalePrice = c(12.247694320221, 12.109010932687,
12.3171666930358, 11.8493977015914, 12.4292161968444), MSSubClass20 = c(0,
1, 0, 0, 0), MSSubClass30 = c(0, 0, 0, 0, 0), MSSubClass60 = c(1,
0, 1, 0, 1), MSSubClass70 = c(0, 0, 0, 1, 0), MSSubClass75 = c(0,
0, 0, 0, 0), MSSubClass85 = c(0, 0, 0, 0, 0), MSSubClass90 = c(0,
0, 0, 0, 0), MSSubClass120 = c(0, 0, 0, 0, 0), MSSubClass160 = c(0,
0, 0, 0, 0), MSSubClass190 = c(0, 0, 0, 0, 0), MSZoningRH = c(0,
0, 0, 0, 0), MSZoningRL = c(1, 1, 1, 1, 1), MSZoningRM = c(0,
0, 0, 0, 0), StreetPave = c(1, 1, 1, 1, 1), AlleyNone = c(1,
1, 1, 1, 1), AlleyPave = c(0, 0, 0, 0, 0), LotShape1 = c(0, 0,
0, 0, 0), LotShape2 = c(0, 0, 1, 1, 1), LotShape3 = c(1, 1, 0,
0, 0), LandContour1 = c(0, 0, 0, 0, 0), LandContour2 = c(0, 0,
0, 0, 0), LandContour3 = c(1, 1, 1, 1, 1), LotConfigCulDSac = c(0,
0, 0, 0, 0), LotConfigFR2 = c(0, 1, 0, 0, 1), LotConfigInside = c(1,
0, 1, 0, 0), LandSlope1 = c(0, 0, 0, 0, 0), LandSlope2 = c(1,
1, 1, 1, 1), NeighborhoodBrDale = c(0, 0, 0, 0, 0), NeighborhoodBrkSide = c(0,
0, 0, 0, 0), NeighborhoodClearCr = c(0, 0, 0, 0, 0), NeighborhoodCrawfor = c(0,
0, 0, 1, 0), NeighborhoodEdwards = c(0, 0, 0, 0, 0), NeighborhoodGilbert = c(0,
0, 0, 0, 0), NeighborhoodIDOTRR = c(0, 0, 0, 0, 0), NeighborhoodMeadowV = c(0,
0, 0, 0, 0), NeighborhoodMitchel = c(0, 0, 0, 0, 0), NeighborhoodNAmes = c(0,
0, 0, 0, 0), NeighborhoodNoRidge = c(0, 0, 0, 0, 1), NeighborhoodNridgHt = c(0,
0, 0, 0, 0), NeighborhoodNWAmes = c(0, 0, 0, 0, 0), NeighborhoodOldTown = c(0,
0, 0, 0, 0), NeighborhoodSawyer = c(0, 0, 0, 0, 0), NeighborhoodSawyerW = c(0,
0, 0, 0, 0), NeighborhoodSomerst = c(0, 0, 0, 0, 0), NeighborhoodStoneBr = c(0,
0, 0, 0, 0), NeighborhoodSWISU = c(0, 0, 0, 0, 0), NeighborhoodTimber = c(0,
0, 0, 0, 0), NeighborhoodVeenker = c(0, 1, 0, 0, 0), Condition1Feedr = c(0,
1, 0, 0, 0), Condition1Norm = c(1, 0, 1, 1, 1), Condition1PosN = c(0,
0, 0, 0, 0), Condition1RRAe = c(0, 0, 0, 0, 0), Condition1RRAn = c(0,
0, 0, 0, 0), Condition2Norm = c(1, 1, 1, 1, 1), BldgType2fmCon = c(0,
0, 0, 0, 0), BldgTypeDuplex = c(0, 0, 0, 0, 0), BldgTypeTwnhs = c(0,
0, 0, 0, 0), BldgTypeTwnhsE = c(0, 0, 0, 0, 0), HouseStyle1.5Unf = c(0,
0, 0, 0, 0), HouseStyleSFoyer = c(0, 0, 0, 0, 0), OverallQual7 = c(1,
0, 1, 1, 0), OverallQual8 = c(0, 0, 0, 0, 1), OverallQual9 = c(0,
0, 0, 0, 0), OverallQual10 = c(0, 0, 0, 0, 0), OverallCond4 = c(0,
0, 0, 0, 0), OverallCond6 = c(0, 0, 0, 0, 0), OverallCond7 = c(0,
0, 0, 0, 0), OverallCond8 = c(0, 1, 0, 0, 0), OverallCond9 = c(0,
0, 0, 0, 0), RoofStyleGable = c(1, 1, 1, 1, 1), RoofStyleGambrel = c(0,
0, 0, 0, 0), RoofStyleHip = c(0, 0, 0, 0, 0), `RoofMatlTar&Grv` = c(0,
0, 0, 0, 0), Exterior1stBrkFace = c(0, 0, 0, 0, 0), Exterior1stCemntBd = c(0,
0, 0, 0, 0), Exterior1stHdBoard = c(0, 0, 0, 0, 0), Exterior1stMetalSd = c(0,
1, 0, 0, 0), Exterior1stPlywood = c(0, 0, 0, 0, 0), Exterior1stVinylSd = c(1,
0, 1, 0, 1), `Exterior1stWd Sdng` = c(0, 0, 0, 1, 0), Exterior1stWdShing = c(0,
0, 0, 0, 0), Exterior2ndBrkFace = c(0, 0, 0, 0, 0), Exterior2ndCmentBd = c(0,
0, 0, 0, 0), Exterior2ndHdBoard = c(0, 0, 0, 0, 0), Exterior2ndImStucc = c(0,
0, 0, 0, 0), Exterior2ndMetalSd = c(0, 1, 0, 0, 0), Exterior2ndPlywood = c(0,
0, 0, 0, 0), Exterior2ndStucco = c(0, 0, 0, 0, 0), MasVnrTypeStone = c(0,
0, 0, 0, 0), ExterCond3 = c(1, 1, 1, 1, 1), FoundationCBlock = c(0,
1, 0, 0, 0), FoundationPConc = c(1, 0, 1, 0, 1), BsmtQual2 = c(0,
0, 0, 0, 0), BsmtQual3 = c(0, 0, 0, 1, 0), BsmtQual5 = c(0, 0,
0, 0, 0), BsmtCond2 = c(0, 0, 0, 0, 0), BsmtCond3 = c(1, 1, 1,
0, 1), BsmtCond4 = c(0, 0, 0, 1, 0), BsmtExposure2 = c(0, 0,
1, 0, 0), BsmtExposure3 = c(0, 0, 0, 0, 1), BsmtFinType11 = c(0,
0, 0, 0, 0), BsmtFinType12 = c(0, 0, 0, 0, 0), BsmtFinType14 = c(0,
0, 0, 0, 0), BsmtFinType16 = c(1, 0, 1, 0, 1), BsmtFinType22 = c(0,
0, 0, 0, 0), BsmtFinType23 = c(0, 0, 0, 0, 0), BsmtFinType24 = c(0,
0, 0, 0, 0), BsmtFinType25 = c(0, 0, 0, 0, 0), BsmtFinType26 = c(0,
0, 0, 0, 0), HeatingGasA = c(1, 1, 1, 1, 1), HeatingGasW = c(0,
0, 0, 0, 0), HeatingQC2 = c(0, 0, 0, 0, 0), HeatingQC3 = c(0,
0, 0, 0, 0), HeatingQC4 = c(0, 0, 0, 1, 0), HeatingQC5 = c(1,
1, 1, 0, 1), CentralAirY = c(1, 1, 1, 1, 1), ElectricalFuseF = c(0,
0, 0, 0, 0), KitchenQual3 = c(0, 1, 0, 0, 0), KitchenQual4 = c(1,
0, 1, 1, 1), KitchenQual5 = c(0, 0, 0, 0, 0), FunctionalMod = c(0,
0, 0, 0, 0), FunctionalTyp = c(1, 1, 1, 1, 1), FireplaceQu1 = c(0,
0, 0, 0, 0), FireplaceQu2 = c(0, 0, 0, 0, 0), FireplaceQu4 = c(0,
0, 0, 1, 0), FireplaceQu5 = c(0, 0, 0, 0, 0), GarageTypeAttchd = c(1,
1, 1, 0, 1), GarageTypeBasment = c(0, 0, 0, 0, 0), GarageTypeBuiltIn = c(0,
0, 0, 0, 0), GarageTypeDetchd = c(0, 0, 0, 1, 0), `GarageTypeNo Garage` = c(0,
0, 0, 0, 0), GarageFinish1 = c(0, 0, 0, 1, 0), GarageFinish2 = c(1,
1, 1, 0, 1), GarageFinish3 = c(0, 0, 0, 0, 0), GarageQual2 = c(0,
0, 0, 0, 0), GarageQual3 = c(1, 1, 1, 1, 1), GarageQual4 = c(0,
0, 0, 0, 0), GarageCond2 = c(0, 0, 0, 0, 0), GarageCond3 = c(1,
1, 1, 1, 1), PavedDrive1 = c(0, 0, 0, 0, 0), PavedDrive2 = c(1,
1, 1, 1, 1), Fence1 = c(0, 0, 0, 0, 0), Fence2 = c(0, 0, 0, 0,
0), Fence3 = c(0, 0, 0, 0, 0), MoSold3 = c(0, 0, 0, 0, 0), MoSold4 = c(0,
0, 0, 0, 0), MoSold5 = c(0, 1, 0, 0, 0), MoSold6 = c(0, 0, 0,
0, 0), MoSold7 = c(0, 0, 0, 0, 0), MoSold8 = c(0, 0, 0, 0, 0),
MoSold11 = c(0, 0, 0, 0, 0), MoSold12 = c(0, 0, 0, 0, 1),
YrSold2007 = c(0, 1, 0, 0, 0), YrSold2008 = c(1, 0, 1, 0,
1), YrSold2010 = c(0, 0, 0, 0, 0), SaleTypeNew = c(0, 0,
0, 0, 0), SaleTypeWD = c(1, 1, 1, 1, 1), SaleConditionFamily = c(0,
0, 0, 0, 0), SaleConditionNormal = c(1, 1, 1, 0, 1), SaleConditionPartial = c(0,
0, 0, 0, 0), Remodel1 = c(0, 0, 1, 1, 0), Newhouse1 = c(0,
0, 0, 0, 0)), row.names = c(NA, 5L), class = "data.frame")