Knn and nn models not saving as variables

I'm building several models. My large Knn, ada and nn models are not saving as variables after they are trained. My glm, and dtree models do save. When I open R Studio again, I have to rerun the models which takes hours. Here is an example knn model.

Cross validation 10-fold CV

cross_validation <- trainControl(method = "repeatedcv",
number = 10,
repeats = 3)

Hyper-parameter tuning

Param_Grid <- expand.grid(k = 1:10)

fit the model to training data

Knn_prev <- train(HN_data_x_train_prev_norm,
method = "knn",
tuneGrid = Param_Grid,
trControl = cross_validation)

What do you mean...
That Knn_prev doesn't have content when the train completes? Does train error?

Or do you mean that you dont know how to save it to disk?
You can try base::save or base::saveRDS

Correct. Knn_prev doesn't save any content when train completes. Train does not error. It prints the intended model. I attached my glm_fit_SMOTE train and it shows as saved data to the right.

Im surprised you shared output for your successful code but not for the code you are having trouble with...

Can you identify with me what package this train function is from?

The code I'm having trouble with is in the first message. The model trains but does not save as variable "Knn_prev".

What is the result of


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.