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!
0 个评论
回答(2 个)
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 个评论
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
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".
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Learner App 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!