Skip to content

Machine Learning: Predict Using a Neural Network

This tutorial demonstrates how to perform predictions using a multilayer perceptron trianed for regression using SciKit-Learn.


In order to perform this tutorial, the ML Training tutorial must be completed.

1. Acquire Data

The data we use in this tutorial is taken from a recent model of small molecule adsorption to transition metal nanoparticles. Specifically, we use DFT-calculated values for the adsorption energy of ·CH3, CO, and ·OH radicals to Ag, Au, and Cu nanoparticles ranging in size from 55 to 172 atoms.

This File contains the data we will use in this tutorial for predictions. A sample of the first 5 lines in the file can be found below:

CE_Local_eV ChemPot_eV MADS_eV
-2.38 -4.96 -2.10
-3.35 -4.96 -2.10
-4.81 -4.96 -2.10
-4.60 -4.96 -2.10

2. Upload the Data

In order to upload predict data, we first click the Dropbox button in the left sidebar. This will bring us to the Dropbox Page. We can then click the "Upload" button, circled below:

Dropbox Page with Upload

Then, when the browser's upload window appears, we navigate to where we downloaded the file in section 1, and select it for upload. If the upload was successful, the file will then be visible in the dropbox.

Take note of the name of the file. For the purposes of this tutorial, it should be named data_to_predict_with.csv

3. Create the ML Job

Next, we can create a new job by selecting the Create Job button in the left sidebar. This will bring us to a new job on the Job Designer page.

First, we will give the job a friendly name, such as "Python ML Tutorial Prediction" (see below). Then, we will click the Actions Button (the three vertical dots in the upper-right of the job designer), and choose "Select Workflow."

Job Designer with Circles

This will bring up the Select Workflow dialogue. We then search for "workflow:pyml_predict" and click on it to bring it into our account.

4. Configure the ML Workflow

We now have our ML workflow selected. Select the Workflows Tab, and we can see our predict workflow.

We can see two subworkflows available: Set Up the Job and Machine Learning.

Specify the Prediction Data

We will first configure the Set Up the Job workflow to accept our predict data.

Begin by selecting the "Declare Predict Data" workflow unit, circled below:

Prediction Data IO Unit

We can now see the "Declare Predict Data" IO unit. Because we named our file in dropbox data_to_predict_with.csv earlier, we do not need to modify this unit. In a scenario where we wanted to use a different file name for our predict data, the Workflow Designer could be used to modify the value.

A Word of Caution

The only modifications that should be made in the Set Up the Job subworkflow are the filenames in the "Declare Training Data" and "Declare Predict Data" IO units. The Set Up the Job subworkflow is automatically re-configured during the training process. Modifying other values, or adding/removing workflow units to this subworkflow, can disrupt creation of the Predict workflow.

We will then close the Declare Predict Data IO unit by clicking on the "X" in the dialogue's upper right corner. This will bring us back to the Workflows Tab.

6. Submit the Job

Click the check-mark in the upper right of the job designer, in the Header Menu to save the job. We now return to the job explorer page with the job in a pre-submission status.

We can now run the job and wait for it to complete.

7. Analyze the Prediction Results

After a few minutes, the job will complete. In the files tab, we can find a new file called "predictions.csv", which contains the predictions generated by this model. Under the hood, this model is created inside of the Train/Predict workflow unit.


This tutorial is demonstrated in the following animation: