In this example, a Bayes classifier learning model will be trained to 2 modes of relationships between b and a.
|0||b/a = 2|
|1||b/a = 3|
After training the model, this dynamic learning model will be tested with some input data and will be able to recognize when the input data matches these 2 trained modes as well as 2 new modes (which will be automatically categorized as mode 2 and mode 3.
$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:
Make sure the following definition file is added to pilots/util/learningmodel/engine/definitions
Make sure the following schema file is added to pilots/util/learningmodel/engine/data
Make sure the following data file is added to pilots/util/learningmodel/engine/data
Make sure server.json in pilots/util/learningmodel/engine is edited to include the new learning model by adding these lines.
Make sure the learning model id is correctly mapped to sklearn learning model in pilots/util/learningmodel/engine/scbase/algorithms.py
In Terminal 1, run the engineIO with the new learning model definition (while in pilots/util/learningmodel/engine):
python engineIO.py definitions/bayes_prediction_test.json
In Terminal 1, run server.sh in pilots/util/learningmodel/engine
(note: you may need to wait a few seconds for the server to start up)
Make sure that the following data file is added to data/PredictionTest_mode
In Terminal 2, make sure to call source setenv from the root directory, and then execute outputHandler in examples/PredictionTest
In Terminal 3, make sure to call source setenv from the root directory, and then compile PredictionTest_mode.plt in examples/PredictionTest_mode using the command:
In Terminal 3, compile the generated PredictionTest_mode.java in examples/PredictionTest_mode
In Terminal 3, execute the new PredictionTest_mode class file with the appropriate arguments. To simplify this process, execute the script PredictionTest_mode in examples/PredictionTest_mode
(Notice that the classpath is defined within this execution script.)
In Terminal 4, make sure to call source setenv from the root directory, and then (in order to produce the simulation) execute PredictionTest_modeProducer in examples/PredictionTest_mode
In Terminal 3, press enter. (After this, some warning messages may appear in this terminal, but they do not hinder the simulation.)
If these steps are executed correctly, you should observe the following output in the Output Handler (terminal 2):
Notice in this output that modes 0 and 1 were correctly identified in the appropriate moments in the input data (from the producer). Additionally, 2 new modes were dynamically discovered when (b/a) fell into significantly new patterns (which were b/a=4 and b/a=0.5).
Worldwide Computing Laboratory
Department of Computer Science
Rensselaer Polytechnic Institute