3.1.2.6. Running the machine learning model test set #1

In this example, we perform the “action” of running “first” set of machine learning (ML) model tests of the ML model trained from the action described in this page. The ML model tests use the ML datasets generated from the action described in this page.

NOTE: Users are advised to read the remainder of the current page in its entirety before trying to execute this action.

To execute the action, first we need to change into the directory <root>/examples/modelling/cbed/distortion/estimation/scripts, where <root> is the root of the emicroml repository. Then, we need to run the Python script ./execute_action.py via the terminal command:

python execute_action.py --action=<action> --use_slurm=<use_slurm>

where <action> must be equal to run_ml_model_test_set_1, and <use_slurm> is either yes or no. If <use_slurm> equals yes and a SLURM workload manager is available on the server from which you intend to run the script, then the action will be performed as a SLURM job. If <use_slurm> is equal to no, then the action will be performed locally without using a SLURM workload manager.

If the action is to be performed locally without using a SLURM workload manager, then prior to executing the above Python script, a set of Python libraries need to be installed in the Python environment within which said Python script is to be executed. See this page for instructions on how to do so. If the action is being performed as a SLURM job, then prior to executing any Python commands that do not belong to Python’s standard library, a customizable sequence of commands are executed that are expected to try to either activate an existing Python virtual environment, or create then activate one, in which the Python libraries needed to complete the action successfully are installed. See this page for instructions how to customize the sequence of commands.

The action described at the beginning of the current page takes automatically as input data output data generated by the action described in the pages Combining machine learning datasets for the machine learning model test set #1 and Training a machine learning model, hence one must execute the two actions described in those two pages prior to the action described at the beginning of the current page. Upon successful completion of the action described at the beginning of the current page, for every string <disk_size> in the sequence (small, medium, large), the aforementioned ML model will have been tested against the ML testing dataset stored in the HDF5 file at the file path <top_level_data_dir>/ml_datasets/ml_datasets_for_ml_model_test_set_1/ml_datasets_with_cbed_patterns_of_MoS2_on_amorphous_C/ml_dataset_with_<disk_size>_sized_disks.h5, with the ML model testing having been performed using the class emicroml.modelling.cbed.distortion.estimation.MLModelTester, and the output data files having been saved in the directory <top_level_data_dir>/ml_models/ml_model_0/ml_model_test_set_1_results/results_for_cbed_patterns_of_MoS2_on_amorphous_C_with_<disk_size>_sized_disks, where <top_level_data_dir> is <root>/examples/modelling/cbed/distortion/estimation/data.

In executing the action described at the beginning of the current page, multiple scripts are executed. The particular scripts that are executed depend on the command line arguments of the parent Python script introduced at the beginning of this page. If <use_slurm> equals yes, then the following scripts are executed in the order that they appear directly below:

<root>/examples/modelling/cbed/distortion/estimation/scripts/execute_action.py <root>/examples/modelling/cbed/common/scripts/run_ml_model_test_set_1/execute_all_action_steps.py <root>/examples/modelling/cbed/common/scripts/run_ml_model_test_set_1/prepare_and_submit_slurm_job.sh <root>/examples/modelling/cbed/common/scripts/run_ml_model_test_set_1/execute_main_action_steps.py

Otherwise, if <use_slurm> equals no, then the third script, i.e. the one with the basename prepare_and_submit_slurm_job.sh is not executed. See the contents of the scripts listed above for implementation details. The last script uses the module emicroml.modelling.cbed.distortion.estimation. It is recommended that you consult the documentation of said module as you explore said script. Lastly, if the action is being performed as a SLURM job, then the default sbatch options, which are specified in the file with the basename prepare_and_submit_slurm_job.sh, can be overridden by following the instructions in this page.