load(system.file("data", "LF.data.rda", package="LogicForest"))
data(LF.data)
#Set using annealing parameters using the logreg.anneal.control
#function from LogicReg package
newanneal<-logreg.anneal.control(start=1, end=-2, iter=2500)
#typically more than 2500 iterations (iter>25000) would be used for
#the annealing algorithm. A typical forest also contains at
#least 100 trees. These parameters were set to allow for faster
#run times
#The data set LF.data contains 50 binary predictors and a binary
#response Ybin
LF.fit1<-logforest(resp=LF.data$Ybin, Xs=LF.data[,1:50], nBS=20, anneal.params=newanneal)
print(LF.fit1)
#> Number of logic regression trees = 20
#> Out of Bag Misclassification = 0.115
#>
#> 5 most important predictors
#>
#> Top 5 Predictors Normalized Predictor Importance Frequency
#> 1 X4 1 19
#> 2 X5 0.9965 19
#> 3 X17 0.0118 2
#> 4 X20 0.0038 1
#> 5 X50 0.0035 1
#>
#> 5 most important interactions
#>
#> Top 5 Interactions Normalized Interaction Importance Frequency
#> 1 X4 & X5 1 16
#> 2 X5 0.0673 1
#> 3 X4 & X50 0.0345 1
#> 4 X4 & X5 & !X17 0.0286 1
#> 5 X4 & X5 & !X30 0.0234 1
predict(LF.fit1)
#> OOB Predicted values
#>
#> [1] 1 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0
#> [38] 0 0 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0
#> [75] 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0
#> [112] 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 1 1 0 0
#> [149] 1 0 1 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0
#> [186] 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0
#>
#> Proportion of OOB trees that predict 1
#> [1] 1.00000000 1.00000000 0.00000000 0.00000000 0.00000000 1.00000000
#> [7] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 1.00000000
#> [13] 1.00000000 0.08333333 0.00000000 1.00000000 0.00000000 0.83333333
#> [19] 0.16666667 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [25] 0.00000000 1.00000000 1.00000000 1.00000000 1.00000000 0.00000000
#> [31] 0.00000000 0.00000000 1.00000000 0.00000000 0.00000000 1.00000000
#> [37] 0.00000000 0.12500000 0.00000000 0.00000000 0.00000000 0.00000000
#> [43] 0.11111111 1.00000000 0.00000000 0.00000000 1.00000000 0.00000000
#> [49] 1.00000000 1.00000000 1.00000000 1.00000000 0.00000000 1.00000000
#> [55] 0.00000000 1.00000000 0.00000000 1.00000000 1.00000000 0.00000000
#> [61] 1.00000000 0.00000000 1.00000000 0.00000000 1.00000000 0.14285714
#> [67] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000
#> [73] 1.00000000 0.00000000 1.00000000 0.00000000 0.11111111 1.00000000
#> [79] 0.00000000 0.00000000 1.00000000 1.00000000 0.00000000 1.00000000
#> [85] 1.00000000 1.00000000 1.00000000 1.00000000 0.80000000 0.85714286
#> [91] 1.00000000 0.00000000 1.00000000 1.00000000 1.00000000 1.00000000
#> [97] 0.00000000 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [103] 0.00000000 0.00000000 1.00000000 0.00000000 1.00000000 1.00000000
#> [109] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [115] 0.00000000 1.00000000 0.00000000 0.16666667 0.00000000 0.00000000
#> [121] 0.00000000 1.00000000 0.00000000 1.00000000 0.00000000 1.00000000
#> [127] 1.00000000 1.00000000 0.10000000 0.00000000 0.00000000 0.00000000
#> [133] 0.12500000 1.00000000 1.00000000 1.00000000 0.00000000 1.00000000
#> [139] 1.00000000 1.00000000 0.00000000 0.00000000 1.00000000 1.00000000
#> [145] 1.00000000 1.00000000 0.00000000 0.00000000 1.00000000 0.20000000
#> [151] 1.00000000 0.00000000 1.00000000 1.00000000 1.00000000 0.00000000
#> [157] 0.00000000 0.00000000 1.00000000 0.00000000 1.00000000 0.00000000
#> [163] 0.00000000 0.14285714 0.14285714 0.00000000 0.00000000 1.00000000
#> [169] 1.00000000 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [175] 0.11111111 0.12500000 1.00000000 0.00000000 0.00000000 0.33333333
#> [181] 0.00000000 1.00000000 0.00000000 1.00000000 0.00000000 0.00000000
#> [187] 0.00000000 0.00000000 1.00000000 1.00000000 1.00000000 0.00000000
#> [193] 1.00000000 1.00000000 0.00000000 0.16666667 1.00000000 1.00000000
#> [199] 0.00000000 0.00000000
#Changing print parameters
LF.fit2<-logforest(resp=LF.data$Ybin, Xs=LF.data[,1:50], nBS=20,
anneal.params=newanneal, norm=TRUE, numout=10)
print(LF.fit2)
#> Number of logic regression trees = 20
#> Out of Bag Misclassification = 0.115
#>
#> 10 most important predictors
#>
#> Top 10 Predictors Normalized Predictor Importance Frequency
#> 1 X4 1 19
#> 2 X5 0.7687 17
#> 3 X10 0.028 1
#> 4 X9 0.0093 1
#> 5 X1 0 <NA>
#> 6 X2 0 <NA>
#> 7 X3 0 <NA>
#> 8 X6 0 <NA>
#> 9 X7 0 <NA>
#> 10 X8 0 <NA>
#>
#> 10 most important interactions
#>
#> Top 10 Interactions Normalized Interaction Importance Frequency
#> 1 X4 & X5 1 16
#> 2 X4 0.1468 3
#> 3 X5 0.0499 1
#> 4 X5 & !X21 & X44 0.0084 1
#> 5 X9 & X10 0.0065 1
#> 6 X4 & !X13 & !X29 0 1
#> 7 <NA> <NA> <NA>
#> 8 <NA> <NA> <NA>
#> 9 <NA> <NA> <NA>
#> 10 <NA> <NA> <NA>