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 X5 1 20
#> 2 X4 0.6592 19
#> 3 X9 0.0059 1
#> 4 X2 0 <NA>
#> 5 X3 0 <NA>
#>
#> 5 most important interactions
#>
#> Top 5 Interactions Normalized Interaction Importance Frequency
#> 1 X4 & X5 1 18
#> 2 X5 0.0544 1
#> 3 !X1 & X4 & X5 0.0221 1
#> 4 X5 & !X42 0.0161 1
#> 5 X5 & !X9 0.0131 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.0000000 1.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000
#> [8] 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 1.0000000 0.0000000
#> [15] 0.0000000 1.0000000 0.0000000 1.0000000 0.0000000 1.0000000 0.0000000
#> [22] 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 1.0000000 1.0000000
#> [29] 0.8333333 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
#> [36] 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> [43] 0.1428571 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 1.0000000
#> [50] 0.8750000 1.0000000 1.0000000 0.0000000 1.0000000 0.0000000 1.0000000
#> [57] 0.0000000 1.0000000 1.0000000 0.0000000 1.0000000 0.2500000 0.8750000
#> [64] 0.0000000 1.0000000 0.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [71] 1.0000000 1.0000000 1.0000000 0.0000000 1.0000000 0.0000000 0.0000000
#> [78] 1.0000000 0.0000000 0.0000000 1.0000000 1.0000000 0.0000000 1.0000000
#> [85] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [92] 0.0000000 1.0000000 0.9090909 1.0000000 1.0000000 0.0000000 0.8333333
#> [99] 0.1111111 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000
#> [106] 0.0000000 1.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> [113] 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000
#> [120] 0.0000000 0.3333333 1.0000000 0.0000000 1.0000000 0.0000000 1.0000000
#> [127] 1.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> [134] 1.0000000 1.0000000 1.0000000 0.0000000 1.0000000 1.0000000 1.0000000
#> [141] 0.0000000 0.1111111 1.0000000 0.9230769 1.0000000 1.0000000 0.0000000
#> [148] 0.0000000 1.0000000 0.0000000 1.0000000 0.0000000 1.0000000 1.0000000
#> [155] 0.9000000 0.1111111 0.2000000 0.0000000 1.0000000 0.0000000 1.0000000
#> [162] 0.0000000 0.0000000 0.1111111 0.0000000 0.0000000 0.0000000 1.0000000
#> [169] 1.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.2000000
#> [176] 0.0000000 1.0000000 0.0000000 0.0000000 0.1000000 0.0000000 1.0000000
#> [183] 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000
#> [190] 1.0000000 1.0000000 0.0000000 1.0000000 0.8888889 0.0000000 0.0000000
#> [197] 1.0000000 1.0000000 0.0000000 0.0000000
#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 19
#> 2 X4 0.9856 19
#> 3 X1 0 <NA>
#> 4 X2 0 <NA>
#> 5 X3 0 <NA>
#> 6 X6 0 <NA>
#> 7 X7 0 <NA>
#> 8 X8 0 <NA>
#> 9 X9 0 <NA>
#> 10 X10 0 <NA>
#>
#> 10 most important interactions
#>
#> Top 10 Interactions Normalized Interaction Importance Frequency
#> 1 X4 & X5 1 18
#> 2 X4 0.0467 1
#> 3 X5 0.0435 1
#> 4 <NA> <NA> <NA>
#> 5 <NA> <NA> <NA>
#> 6 <NA> <NA> <NA>
#> 7 <NA> <NA> <NA>
#> 8 <NA> <NA> <NA>
#> 9 <NA> <NA> <NA>
#> 10 <NA> <NA> <NA>