仔细检查dismo::gbm.interactions
函数后,我发现dismo::gbm.fixed
返回的对象与gbm.interactions
.
以下是如何修改您的代码:
library(dismo)
data(Anguilla_train)
angaus.fixed <- gbm.fixed(data=Anguilla_train, gbm.x = 3:13,
gbm.y = 2,family = "bernoulli", tree.complexity = 5, learning.rate = 0.01,
bag.fraction = 0.5, n.trees = 5000)
# Change the name of angaus.fixed$gbm.call$data with angaus.fixed$gbm.call$dataframe
names(angaus.fixed$gbm.call)[1] <- "dataframe"
find.int <- gbm.interactions(angaus.fixed)
######
gbm.interactions - version 2.9
Cross tabulating interactions for gbm model with 11 predictors
1 2 3 4 5 6 7 8 9 10
现在gbm.interactions
可以很好地工作并产生以下结果:
find.int$interactions
#######
SegSumT SegTSeas SegLowFlow DSDist DSMaxSlope USAvgT USRainDays USSlope USNative DSDam Method
SegSumT 0 28.35 0.88 150.10 13.20 24.38 30.30 17.85 22.57 0.27 44.68
SegTSeas 0 0.00 17.66 130.69 7.96 16.93 3.14 18.59 25.90 0.14 4.15
SegLowFlow 0 0.00 0.00 5.92 3.85 6.88 4.69 10.85 5.06 0.09 6.23
DSDist 0 0.00 0.00 0.00 2.40 10.68 47.77 41.54 6.82 0.01 11.42
DSMaxSlope 0 0.00 0.00 0.00 0.00 3.22 2.85 3.80 2.64 0.00 1.25
USAvgT 0 0.00 0.00 0.00 0.00 0.00 3.08 11.76 24.90 0.04 1.94
USRainDays 0 0.00 0.00 0.00 0.00 0.00 0.00 4.69 15.26 0.09 18.16
USSlope 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12.08 0.03 19.44
USNative 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.02 12.79
DSDam 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.13
Method 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
find.int$rank.list
#######
var1.index var1.names var2.index var2.names int.size
1 4 DSDist 1 SegSumT 150.10
2 4 DSDist 2 SegTSeas 130.69
3 7 USRainDays 4 DSDist 47.77
4 11 Method 1 SegSumT 44.68
5 8 USSlope 4 DSDist 41.54
6 7 USRainDays 1 SegSumT 30.30