Skip to content

Latest commit

 

History

History

8_machine_learning_example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

◀️   Previous: OpenDB Python API     |     Next: Adding A Tool to OpenROAD   ▶️

Machine Learning Example

In this example, we will use a Graph Convolutional network to train a neural network classifier for netlists.

Dataset

The dataset is generated by synthesizing some designs using different optimizations yielding different graphs that basically represent the same netlist. We use read_netlist.py from the previous example and save all netlists to a file.

For this tutorial, we have generated the dataset for you in dac20-ml-example.zip. The dataset contains 160 graphs that represent 8 designs. Each design has 20 representative netlists, and the design name is used as its class label.

Prepare Your Virtualenv

Let's create a virtualenv to install Python packages.

cd code
virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt

Model Training

The code is divided into three files:

Run the training

python main.py dac20-ml-example output

Training Loss

Epochs: 50

Classification Accuracy on Test Set

  • Accuracy of sampled predictions: 62.50%
  • Accuracy of argmax predictions: 75.00%

Conclusion

This example capitalizes on OpenDB capabilities and show how straightforward it is to start building ML models on OpenDB. There are many enhancements that can (and should) be done in the model. Feel free to fork the code and use it in your project. Please, keep the license header.

◀️   Previous: OpenDB Python API     |     Next: Adding A Tool to OpenROAD   ▶️