This page details instructions on how to execute a given PILOTS example with machine learning and serves as a guide for constructing and implementing new learning models.
Running a PILOTS program entails calling operations on the machine learning server, which can train machine learning models, validate the accuracy of these models, or calculate the results of these models models on specified data which can be used by other programs.
Note: The following commands shown for the command line are assumed to be implemented in the bash shell
The steps for interacting with the machine learning component of PILOTS are as follows:
Make sure to install the following before working with the learning model component of PILOTS:
Then simply run at the root directory of the project:
virtualenv . source bin/activate
Finally run the following in the pilots/util/model/ directory:
pip3 install -r requirements.txt
$PILOTS_HOME, run the build script
$ ./build.sh // (for Windows, use build.bat instead)
After doing so, pilots.jar will be created under the
In order to make sure that aliases for the plc and plcsim compiler commands are correctly figured as well as the definition of $PILOTS_HOME, make sure that you are in the root directory of the project and then use the following command:
Training a model requires that the machine learning algorithm is implemented and you have a training PILOTS program to train that algorithm. The available machine learning algorithms can be found in the model code directory.. To implement a custom algorithm follow the Application Programming Interface (API) given in Example.py file.
The result of training a machine learning algorithms is a model file, which can be found in the trained models directory. These files are used by normal PILOTS programs to estimate values given to the model during runtime.
To train a model run a compiled trainer file (.trn) along with the machine learning server and the resulting trained model file will be produced. Compiling a .trn can be done using the pilots compiler with the -t flag, e.g.
plc -t example_trainer_file.trn
Make sure that the data that you intend to use for your producers in a simulation are stored in the data directory.
Follow the format similar to a.txt from the PredictionTest linear regression example.
Note: Notice that the first line of the file must be a header beginning with a pound sign (#). If you are expecting an output for the input, based on the learning model, then make sure to also include the label of the output similar to that defined in the model training data.
A socket connection must be made with the learning model server client in order to interact with the PILOTS machine learning component. Therefore, before running the plt program, run the learning model server by executing the server.sh script in pilots/util/model/
(Note: you may need to wait a few seconds for the server to start up)
Once the previous procedures are completed, follow these 3 main steps:
If a simulation is being run, go back to the terminal running the class generated from the plt file, and press enter. (After this, some warning messages may appear in this terminal, but they do not hinder the simulation.)
For some simple examples of the execution of a PILOTS program with the machine learning component (offline), refer to the:
Worldwide Computing Laboratory
Department of Computer Science
Rensselaer Polytechnic Institute