Unable to save session in Classification Learner

12 ビュー (過去 30 日間)
Sonia Tan
Sonia Tan 2022 年 7 月 22 日
回答済み: Antonio 2024 年 1 月 19 日
I have trained models in classification learner based on a dataset and am hoping to save the classificationLearner Session so that I do not have to rerun all the models again everytime, which takes quite a long time. I am currently using the R2022a version, and when I try to save the error, I get an error message that says "The file could not be closed, and might now be corrupt." Any advice on how I can get rid of this error and save the session?
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 7 月 22 日
Is it possible that you ran out of disk space?
Sonia Tan
Sonia Tan 2022 年 7 月 22 日
The device that I tried it on had >100GB of space so I think there was still sufficient disk space for storage?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2022 年 7 月 23 日
What do you mean by "rerun the models"? Why do you have to do that? Did your training data change? If not, why rerun?
What I do is to load by predictor table and ground truth responses and train the model. Then I click the Export->Compact Model to put the "trainedModel" variable into the workspace. Then I call save
save('myModel.mat', 'trainedModel');
to save the trained model to disk. Then to apply the model to predict (not train) new estimated response values, I call load
s = load('myModel.mat');
trainedModel = s.trainedModel;
then call predict() with a table of new data and the trainedModel variable. That will give me an estimated value for each new test value.
  5 件のコメント
Image Analyst
Image Analyst 2022 年 7 月 26 日
I'd call tech support then.
Sonia Tan
Sonia Tan 2022 年 7 月 26 日
okay, thank you!

サインインしてコメントする。

その他の回答 (1 件)

Antonio
Antonio 2024 年 1 月 19 日
In my case, this problem is related to MATLAB having problems saving files larger than 2GB in the default configuration of the "save" function. You can try two options:
  • Export the model as a Compact Model (Export -> Export Compact Model) to the workspace and save from there as normally done with save(). If that compact model meets the 2GB limit, you will have no problem.
  • Otherwise, export the complete or compact model from the workspace using the option '-v7.3' inside the save() function. It was this option that solved the problem in my case.
save(filename, 'modelTrained', '-v7.3')
I hope to be helpful! Sorry I'm late, but I respond for others who have the same problem.

カテゴリ

Help Center および File ExchangeClassification Learner App についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by