mirror of
https://github.com/prise6/aVirtualTwins.git
synced 2024-05-12 21:16:32 +02:00
37 lines
1.1 KiB
R
37 lines
1.1 KiB
R
# VT.FOREST.ONE -----------------------------------------------------------
|
|
# IF RUNNING ONE FOREST COMPUTATION
|
|
# model - modèle de forêt aléatoire issus du package caret, randomForest ou party (cforest)
|
|
VT.forest.one <- setRefClass(
|
|
Class = "VT.forest.one",
|
|
|
|
contains = "VT.forest",
|
|
|
|
fields = list(
|
|
model = "ANY",
|
|
interactions = "logical"
|
|
),
|
|
|
|
methods = list(
|
|
initialize = function(vt.object, model, interactions = T, ...){
|
|
.self$checkModel(model)
|
|
|
|
.self$model <- model
|
|
|
|
.self$interactions <- interactions
|
|
|
|
callSuper(vt.object, ...)
|
|
},
|
|
|
|
computeTwin1 = function(){
|
|
.self$twin1 <- as.vector(VT.predict(rfor = .self$model, type = .self$vt.object$type))
|
|
return(invisible(.self$twin1))
|
|
},
|
|
|
|
computeTwin2 = function(){
|
|
.self$twin2 <- as.vector(VT.predict(.self$model,
|
|
newdata = .self$vt.object$getX(interactions = .self$interactions),
|
|
.self$vt.object$type))
|
|
return(invisible(.self$twin2))
|
|
}
|
|
)
|
|
) |