classification learner app train all model script export

5 次查看(过去 30 天)
Hi all,
I used classification learner app to train ALL models, but I can only export one model training script at a time, how can I export a script that trains all models?
Thanks!

回答(2 个)

Image Analyst
Image Analyst 2023-4-5
The app is the thing that trains the models. It creates models that you can then use to PREDICT responses. It is not meant to create code to TRAIN models. If you want to do that yourself, you'd have to call the various individual classification training functions. See the help on classification
  2 个评论
Yuhong
Yuhong 2023-4-5
Hi,
Yes. I understand what the app is doing. And I did create a function to take X-y (data and label) as input to train various classifiers and I used parfor to accelerate training, but my function is still much slower than using app interface to train the same amount of models, for example, my code takes ~120s and the app only takes ~40s, which the speed is my concerns. And I can't post my code publicly here, can I send my code to you privately? Thanks.
Image Analyst
Image Analyst 2023-4-5
编辑:Image Analyst 2023-4-5
No, sorry. Why can't you just create some sample data that is somewhat similar?

请先登录,再进行评论。


Drew
Drew 2023-4-5
As you know, the "Generate Function" button in the Export section of the Classification Learner app generates MATLAB code for training a model. There is no way to generate MATLAB code for training all models at once. You have to generate the functions for each model one-by-one. It looks like you have done this.
In your comment, you wrote, "And I did create a function to take X-y (data and label) as input to train various classifiers and I used parfor to accelerate training, but my function is still much slower than using app interface to train the same amount of models, for example, my code takes ~120s and the app only takes ~40s, which the speed is my concerns."
At the high level, it should be possible to obtain similar model training speed with your CLI (command line interface) code and the app-interface. Without seeing your CLI code, some possible sources of the difference:
(1) Maybe the CLI code is doing additional operations which are not done at training time in the app. What form of validation are you using, that is, for example, 5-fold cross-validation, or something else? Are you using a separate test set? Are you partitioning the data only once, or multiple times? The app only partitions the data once, and it does that prior to starting training.
(2) Perhaps the CLI code is using "parfor" for parallelization in a sub-optimal way for your machine, with its unique memory limitations, etc. Some model training code functions will automatically use multi-threading without the use of "parfor".
  1 个评论
Yuhong
Yuhong 2023-4-5
Hi,
Thanks for your reply. I really wish to show you my code, but it's part of my research project I can't do it publicly, can you make a anonymous space for me to upload my code? Thanks.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Classification Learner App 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by