# use iris data set
# build random forests model with certain parameters
modelRF <- CoreModel(Species ~ ., iris, model="rf",
selectionEstimator="MDL",minNodeWeight=5,rfNoTrees=100)
print(modelRF)
# prediction with node distribution
pred <- predict.CoreModel(modelRF, iris, rfPredictClass=FALSE, type="both")
print(pred)
# saves the random forests model to file
saveRF(modelRF, "tempRF.txt")
# restore the model to another model
loadedRF = loadRF(Species ~ ., iris, "tempRF.txt")
# prediction should be the same
predLoaded <- predict.CoreModel(loadedRF, iris, rfPredictClass=FALSE, type="both")
print(predLoaded)
Run the code above in your browser using DataLab