Pass a UQLink model to a .m file model-II

Continuing the discussion from Pass a UQLink model to a .m file model:

Hi @moustapha

Coming back to this post, there is something happening that I don’t quite understand the reason.
When passing the UQLink to .mfile as you suggest*, in a sensitivity analysis or in an active learning reliability analysis, after each run the input and the output files are being deleted (.Archiving is set to save). I think this is related to the fact that it is always “Running Realization 1”.

Command Window
Running Realization 1
Running Realization 1
Running Realization 1
Running Realization 1

I have noticed that for each of those run different inputs is being used, and for active learning, it seems it is working fine since at the end, with the created metamodel I can check the input X and the output Y information for all the different runs. I have also noticed that this specifically happens once I move the UQlink to the .mfile. Before that everything is working just fine.

*mOpts.mFile = ‘myModel_WithModelUncertainty’;
mOpts.Parameters = myUQLinkModel;
mOpts.isVectorized = false;
myModel = uq_createModel(mOpts);

Looking forward to hearing your thoughts on this. Maybe it is because of the vectorization option I have set to false?


Hi @Neryvaldo_Galvao

This behavior is actually normal. The displlay “Running Reallization #” states the sample that is currently run w.r.t. to the vector X as passed to uq_evalModel(myUQLinkModel,X). When doing active learning, only one sample is passed per iteration (at least in your case), which explains why you always have the counter stuck at 1.

Regarding the archiving, it just happens that it is overwritten after each iteration. The name of the folder where the data are saved is automatically built using options of the UQLink model. Since you are using the same UQLink model, the same name is used at each iteration, hence the files/folders are overwritten.
To fix this, you need to enable the TimeStamp option by setting ModelOpts.Archiving.TimeStamp = true. This has the effect of appending to the name of the folders/files generated by UQLink, a time stamp corresponding to the time and date when the UQLink model was called. This then creates a unique ID to the run, so you will get multiple archive folders, but each with one sample.
In my opinion, for your analysis this is not really useful as in any case all the samples are saved within the ANALYSIS itself. Except,if you have errors and need to debug.

I hope I am answering your question.


1 Like