uGUIDE.create_config_uGUIDE¶
- uGUIDE.create_config_uGUIDE(microstructure_model_name, size_x, prior, prior_postprocessing=None, folderpath=None, x_normalizer_file='x_normalizer.p', theta_normalizer_file='theta_normalizer.p', embedder_state_dict_file='torch_embedder.pt', nf_state_dict_file='torch_nf.pt', device=None, use_MLP=True, nf_features=32, hidden_layers=[128, 64], learning_rate=0.001, max_epochs=500, n_epochs_no_change=10, random_seed=None, nb_samples=50000)¶
Create a configuration file for the inference and microstructure parameters estimation.
- Parameters:
- microstructure_model_namestr
Name of the model, used for saving the results
- size_xint
Size of the input data. Used to check inference and estimations are done on the same data.
- priordict
Contains names of the model parameters used for inference with the minimum and maximum bounds of the Uniform prior distributions.
- prior_postprocessingdict, optional
Contains names of the model parameters after postprocessing with the minimum and maximum bounds of the parameters. This is useful when the model parameters have constraints, making their prior distributions non-uniform, such as the Standard Model. If same as prior, set as
None
.- folderpathstr or Path, optional
Path for saving the results. If None, default location will be results/uGUIDE_{microstructure_model_name}.
- x_normalizer_filestr, default=’x_normalizer.p’
Name of the file for saving the normalizer of the input signal.
- theta_normalizer_filestr, defualt=’theta_normalizer.p’
Name of the file for saving the normalizer of the microstructure parameters theta.
- embedder_state_dict_file: str, default=’torch_embedder_SM.pt’
Name of the file for saving the embedded neural network after training.
- nf_state_dict_filestr, default=’torch_nf_SM.pt’
Name of the file for saving the normalizing flow after training.
- device{‘cpu’, ‘cuda’}, optional
Device for running the inference and estimations. If
None
, check if ‘cuda’ is available. If not, use ‘cpu’.- use_MLPbool, default=True
By default, use the MLP for dimension reduction. Set to False to avoid dimensionality reduction and directly use the input signal. In this case, nf_features is set to the the size of the input signal.
- nf_featuresint, default=32
Number of features extracted by the MLP.
- hidden_layerslist, defaults=[128,64]
Number of hidden units per layer for the MLP, used for the features extraction.
- learning_ratefloat, default=1e-3
Learning rate for the Adam optimizer.
- max_epochsint, default=500
Maximum number of epochs for the inference.
- n_epochs_no_changeint, default=10
Number of epochs to wait for improvement on the validation set before stopping training.
- random_seedint, optional
Determines random number generation. Pass an int for reproducible results.
- nb_samplesint, default=50_000
Number of samples drawn from the posterior distribution.
- Returns:
- configdict
Configuration file used for inference and microstructure parameters estimation.