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 20
#> 2 X5 0.7257 18
#> 3 X36 0.0078 2
#> 4 X50 0.006 1
#> 5 X38 0.003 2
#>
#> 5 most important interactions
#>
#> Top 5 Interactions Normalized Interaction Importance Frequency
#> 1 X4 & X5 1 17
#> 2 X4 0.0373 1
#> 3 X4 & X24 0.0236 1
#> 4 X4 & X5 & !X38 0.0207 1
#> 5 X4 & X5 & X50 0.0187 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.00000000 0.16666667 1.00000000 0.00000000 1.00000000
#> [19] 0.00000000 1.00000000 0.14285714 0.16666667 0.00000000 0.00000000
#> [25] 0.00000000 1.00000000 1.00000000 1.00000000 1.00000000 0.00000000
#> [31] 0.14285714 0.00000000 1.00000000 0.00000000 0.00000000 0.90000000
#> [37] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [43] 0.09090909 0.90000000 0.00000000 0.00000000 1.00000000 0.00000000
#> [49] 1.00000000 1.00000000 1.00000000 1.00000000 0.00000000 0.87500000
#> [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.16666667
#> [67] 1.00000000 1.00000000 0.87500000 1.00000000 1.00000000 1.00000000
#> [73] 1.00000000 0.00000000 1.00000000 0.00000000 0.08333333 1.00000000
#> [79] 0.00000000 0.00000000 1.00000000 1.00000000 0.00000000 1.00000000
#> [85] 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000
#> [91] 1.00000000 0.00000000 1.00000000 1.00000000 1.00000000 0.88888889
#> [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.00000000 0.00000000 0.00000000
#> [121] 0.00000000 1.00000000 0.00000000 1.00000000 0.11111111 1.00000000
#> [127] 1.00000000 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [133] 0.33333333 1.00000000 1.00000000 1.00000000 0.00000000 1.00000000
#> [139] 1.00000000 1.00000000 0.00000000 0.10000000 1.00000000 1.00000000
#> [145] 1.00000000 1.00000000 0.00000000 0.00000000 1.00000000 0.00000000
#> [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.00000000 0.12500000 0.00000000 0.25000000 1.00000000
#> [169] 1.00000000 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [175] 0.00000000 0.20000000 1.00000000 0.00000000 0.00000000 0.00000000
#> [181] 0.00000000 1.00000000 0.00000000 0.87500000 0.00000000 0.00000000
#> [187] 0.00000000 0.00000000 1.00000000 1.00000000 1.00000000 0.00000000
#> [193] 1.00000000 1.00000000 0.16666667 0.00000000 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 X5 1 20
#> 2 X4 0.8949 19
#> 3 X9 0.0276 1
#> 4 X10 0.0123 1
#> 5 X2 0.0032 1
#> 6 X1 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 19
#> 2 X5 0.039 1
#> 3 !X2 & X4 & X15 0.007 1
#> 4 X9 & X10 0.0017 1
#> 5 <NA> <NA> <NA>
#> 6 <NA> <NA> <NA>
#> 7 <NA> <NA> <NA>
#> 8 <NA> <NA> <NA>
#> 9 <NA> <NA> <NA>
#> 10 <NA> <NA> <NA>