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:

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.
In this tutorial, you will:
  • 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.

  1. 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
  2. Verify the relative path to the .h3d file is correctly input in the first column and that each .h3d has all the KPIs defined.
  3. 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

  1. Open HyperMesh.
  2. From the menu bar, click View > Ribbons > PhysicsAI to open the PhysicsAI ribbon.
  3. Create a new project called KPI_Tutorial.
    1. From the PhysicsAI ribbon, select the Create Project tool.


      Figure 3.
      The Create Project dialog opens.
    2. For Project Name, enter KPI_Tutorial.
    3. For Location, click Choose and select a save location for the project.
      Note: The save location for the project contains all files created by physicsAI, but the original files used for training do not need to reside in the project folder.
    4. Click OK.
  4. Create a new database called Beam40 using all the .h3d files in the .json creation files folder.
    1. From the PhysicsAI ribbon, select the Create Dataset tool.


      Figure 4.
      The Create Dataset dialog opens.
    2. For Dataset Name, enter Beam40.
    3. For File System, click and navigate to the JSON_creation_files folder.
    4. Select and transfer all of the .h3d files.
    5. Enable the 80:20 split by selecting Enable train test split.
      This will generate two datasets; Beam40_train with 32 files and Beam40_test with eight files.
    6. Click OK.
      The dataset is extracted and the Datasets dialog opens.
    7. Click Close.
  5. Create a new model called Moment_Inertia1.
    1. From the PhysicsAI ribbon, select the Train an ML Model tool.


      Figure 5.
      The Train Model dialog opens.
    2. For Model Name, enter Moment_Inertia_1.
    3. For Training Data, select Beam40_train.
    4. For Vector, select I1 which is the response of interest corresponding to the Moment of Inertia for the I beam.
      Since all the .h3d files used in the Beam40_train database have a corresponding .json file, the KPIs from these files are displayed in the Vector Outputs drop-down menu.


      Figure 6.
  6. Click Train.

Review Results

In this step, you will visualize and review the results.

  1. 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
  2. From the PhysicsAI ribbon, select the Test ML Model tool.


    Figure 8.
    The Test Model dialog opens.
  3. For Models, select Moment_interia1.
  4. For Datasets, select Beam40_test.


    Figure 9.
  5. Click OK.
    The Model Testing dialog opens.
  6. Select a single data point and click Display File.
    The true and predicted responses are shown on the graph.


    Figure 10.


    Figure 11.
    Note: Figure 12 shows an example prediction for a vector KPI.


    Figure 12.
  7. Proceed with the same procedure to make predictions on new data.