R XG中的权重是否会提高线性模型中的系数/估计值?
我使用xgboost功能来优化我的模型,它可以预测二手车的价格R XG中的权重是否会提高线性模型中的系数/估计值?,r,xgboost,gradient-descent,R,Xgboost,Gradient Descent,我使用xgboost功能来优化我的模型,它可以预测二手车的价格 index <- sample((1:nrow(x)), round(0.8*nrow(x))) training <- x[index,] testing <- x[-index,] model.gb <- xgboost(data = as.matrix(training[,-1]), label = as.vector(training[,1]), booste
index <- sample((1:nrow(x)), round(0.8*nrow(x)))
training <- x[index,]
testing <- x[-index,]
model.gb <- xgboost(data = as.matrix(training[,-1]), label = as.vector(training[,1]),
booster = "gblinear", nround = 10)
xgb.importance(model = model.gb)
Feature Weight
1: Fossil_Fuel 3.61236e+03
2: newtypeother 1.01321e+03
3: manucountryEurope 9.93548e+02
4: manucountryAsia 9.39839e+02
5: newcolorcustom 9.00756e+02
6: newtypesmall -8.53919e+02
7: newtitlenot 3.77962e+02
8: newcolorother 1.84748e+02
9: age -8.66712e+01
10: odometer -6.80956e-03
索引
model.saturated <- lm(price~.,data = training)
model.aic.back <- MASS::stepAIC(model.saturated, direction = "backward", trace = 0)
model.aic.back %>% summary()
Call:
lm(formula = price ~ odometer + age + manucountryAsia + manucountryEurope +
newtypeother + newtypesmall + newcolorcustom, data = training)
Residuals:
Min 1Q Median 3Q Max
-15344.7 -2818.1 78.7 3937.1 21003.2
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.502e+04 2.142e+02 70.126 < 2e-16 ***
odometer -3.312e-02 1.642e-03 -20.163 < 2e-16 ***
age -1.400e+02 1.053e+01 -13.302 < 2e-16 ***
manucountryAsia 3.637e+02 1.636e+02 2.223 0.02627 *
manucountryEurope 6.636e+02 2.469e+02 2.688 0.00721 **
newtypeother -1.146e+03 3.467e+02 -3.307 0.00095 ***
newtypesmall -2.111e+03 1.591e+02 -13.264 < 2e-16 ***
newcolorcustom 6.116e+02 4.166e+02 1.468 0.14208
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5583 on 5693 degrees of freedom
Multiple R-squared: 0.1435, Adjusted R-squared: 0.1425
F-statistic: 136.3 on 7 and 5693 DF, p-value: < 2.2e-16