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=None, hidden_layers=[128, 64], n_flows=5, learning_rate=0.0001, scheduler_patience=10, learning_rate_min=1e-05, max_epochs=500, n_epochs_no_change=25, voxel_batch_size=128, random_seed=None, nb_samples=10000, num_threads=8)

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= 2 times the size of theta

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.

n_flowsint, default=5

Number of flows for the normalizing flow.

learning_ratefloat, default=1e-4

Learning rate for the Adam optimizer.

scheduler_patienceint, default=10

Number of epochs with no improvement after which the learning rate will be reduced by a factor of 0.1.

learning_rate_minfloat, default=1e-5

Minimum learning rate for the scheduler. The learning rate will not be reduced below this value.

max_epochsint, default=500

Maximum number of epochs for the inference.

n_epochs_no_changeint, default=25

Number of epochs to wait for improvement on the validation set before stopping training. Good to set it around 2-3 times the scheduler_patience.

voxel_batch_sizeint, default=128

Number of voxels to process in parallel during the inference.

random_seedint, optional

Determines random number generation. Pass an int for reproducible results.

nb_samplesint, default=10_000

Number of samples drawn from the posterior distribution.

num_threadsint, default=8

Number of threads to use for parallel processing during the inference.

Returns:
configdict

Configuration file used for inference and microstructure parameters estimation.