Custom Outputs/KPIs in PhysicsAI Models
Tutorial Level: Intermediate In this tutorial, you will learn the procedure for using your own knowledge point indicators (KPIs) as responses in physicsAI.
The KPIs need to be supplied through .json files. This tutorial involves generating .json files from a .csv file summarizing the KPIs of the entire dataset. However, you are free to use other methods to generate .json files containing the KPIs.
Before you begin, copy the file(s) used in this tutorial to your
working directory.
Note:
In this tutorial, you will:Unzip the project JSON_creation_files.zip and inspect the contents:
- collected_data.csv is a comma separated file which contains a summary of the relative file paths of the various .h3d files and the corresponding KPIs.
- physicsai_csvtojson.py is a python script that reads the .csv file above and generates .json files in the same relative location as the .h3d files listed in the .csv.
- run_000XX_beam.h3d files provided in different locations within the attached folder.
- Update a .csv file with your KPIs.
- Generate .json files corresponding to each of the provided .h3d files.
- Train a physicsAI model to predict a KPI using vector predictions.
Create .json Files
In this step, you will create .json files which contain the KPIs corresponding to the .h3d files.
-
Open the collected_data.csv file.
This file summarizes the relative locations of the different .h3d files provided. Also, the KPI values corresponding to each .h3d file are listed in the columns with an appropriate header. Anyone can edit this file to add or remove KPIs.
Figure 1. KPI Summary Contained in the CSV File - Verify the relative path to the .h3d file is correctly input in the first column and that each .h3d has all the KPIs defined.
-
Run the physicsai_csvtojson.py file.
This file generates the .json files which contain the KPIs in a structured format. Each .json file has the same name as the corresponding .h3d file except that the extension is .json.
Figure 2. Example .json File
Train a PhysicsAI Model for KPIs
- Open HyperMesh.
- From the menu bar, click to open the PhysicsAI ribbon.
-
Create a new project called KPI_Tutorial.
-
Create a new database called Beam40 using all the
.h3d files in the .json creation
files folder.
-
Create a new model called Moment_Inertia1.
- Click Train.
Review Results
In this step, you will visualize and review the results.
-
Click on the Loss Curve.
The overlap between the training and validation loss indicates a well trained model.
Figure 7. Loss Curve for the KPI Training -
From the PhysicsAI ribbon, select the Test ML
Model tool.
Figure 8. The Test Model dialog opens. - For Models, select Moment_interia1.
-
For Datasets, select Beam40_test.
Figure 9. -
Click OK.
The Model Testing dialog opens.
-
Select a single data point and click Display File.
The true and predicted responses are shown on the graph.
Figure 10. Figure 11. - Proceed with the same procedure to make predictions on new data.