epcreg.save {EnsemblePCReg} | R Documentation |
These functions can be used whether filemethod
flag is set to TRUE
or FALSE
during the epcreg
call. Note that epcreg.load
‘returns’ the estimation object (in contrast to the standard load
method).
epcreg.save(obj, file)
epcreg.load(file)
obj |
Object of classes |
file |
Filepath to where |
Function epcreg.load
returns the saved obj
, with estimation files automatically copied to R temporary directory, and filepaths inside the obj
fields updated to point to these new filepaths (if filemethod
was set to TRUE
in the call to epcreg
).
Mansour T.A. Sharabiani, Alireza S. Mahani
data(servo)
myformula <- class~motor+screw+pgain+vgain
perc.train <- 0.7
index.train <- sample(1:nrow(servo), size = round(perc.train*nrow(servo)))
data.train <- servo[index.train,]
data.predict <- servo[-index.train,]
est <- epcreg(myformula, data.train, ncores=2
, baselearner.control=epcreg.baselearner.control(
baselearners="knn"
, baselearner.configs = make.configs("knn"
, config.df = expand.grid(kernel = "rectangular"
, k = c(5, 10)))), filemethod = TRUE)
epcreg.save(est, "somefile")
rm(est) # alternatively, exit and re-launch R session
est.loaded <- epcreg.load("somefile")
newpred <- predict(est.loaded, data.predict)
file.remove("somefile")