I recently downloaded RStudio version 4.2.2 for my experiments since the version I was using was giving me issues. However, I am suprised that the function memory.size()
is showing the error, 'memory.size()' is no longer supported
. I usually use the function to ascertain the initial and final memory during my machine Learning model fiting so as to know the amount of memory that was used. As suggested in this
thread, I have tried it and it couldn't resolve the error. Please since this function is no longer supported, does anyone know which function that I can use? The sample of the code I use for my ML is stated below
> memory.size()
[1] Inf
Warning message:
'memory.size()' is no longer supported
A typical way how I use the function is:
result <- vector("list", 6L)
for (n in 1:5) {
Train <- Training[sample(1:180568, 0.4*nrow(Training)),]
memory.size()
Time1 = Sys.time()
fit_rand <- randomForest(Label~., data= Train)
memory.size()
Time2 = Sys.time()
Train_time = (Time2 - Time1)
print(Train_time)
start_memory = memory.size()
pred_rand <- predict(fit_rand, Testing)
result[[n]] <- confusionMatrix(pred_rand, Testing$Label)
print(result)
Time3 = Sys.time()
Validation_time <- (Time3 - Time2)
print(Validation_time)
stop_memory <- memory.size()
Validation_memory = (stop_memory - start_memory)
}