Is there an equivalent to close all for deep learning training windows?

Hi,
I have some unit tests that produce a large number of deep learning "training progress" windows. Is there an equivalent to the "close all" command for plots for these training windows?
I know you can stop them appearing in the training options but when they are not in unit tests I need them displayed
Thanks,
Dan

댓글 수: 4

I left an answer to your question, but I'm interested that you don't just want to stop the plots appearing in a unit test context. As you know, in trainingOptions you can set Plots, 'none', and perhaps also Verbose, false. This might improve test performance, and let your unit tests avoid affecting global state or printing diagnostics.
Hi, thanks for the answer, that is useful to know, I will it mark as complete as it answered my initial question.
I guess I do not need the training plots to appear as part of unit testing, in my codebase I have set them to only appear if the code is not deployed and if they are not being generated during a large number of models being trained in parallel. Is there a similar function to "isdeployed" that can be used for when the code is run in unit test context? My functions themselves do not take the trainingOptions as direct input.
Makes sense - so you have code where when it's called normally, you want it to make training plots, and then you are writing tests for that code? I don't think there's any equivalent to isdeployed for seeing if something is run in unit tests, so this is a little trickier.
One option you could consider is just exposing a name-value pair in the functions you are writing, AllowPlots, with a default value of true. When the unit tests call this code, they set its value to false, and that gets passed to trainingOptions in the right way. This would stop the tests from showing the plots (and potentially also give callers of your functions the ability to control this if they want to - I don't know if that's desirable).
Somewhere you might want a small number of unit tests which verify the training plot does appear when it's meant to - but you might speed up your test throughput by disabling it where it's not needed.
Yeah that's correct. I will try that, thank you for your help

댓글을 달려면 로그인하십시오.

 채택된 답변

Currently, you can't directly close just deep learning plots with a particular command.
However, it is possible to close all figures, including those with HandleVisibility off. You can use:
close(findall(groot, "Type", "figure"));
Note that this closes all open figures, not just deep learning plots! For more info, see the findall doc.
For unit tests, you probably want to put this in a TestMethodTeardown, so it executes even if the test fails.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by