Skip to content

Repository files navigation

TensorFlow Model Simulation

Testing how a CNN-BiDirectional LSTM model and a Transformer model compare when being fed their own predictions in inference mode.

Since the actual environment is CloudSimPlus in Java, the simulation is set up in Java as well.

Work done as part of CSUN REU Project 1 - Energy Efficiency.

ModelWrapper

Abstracts model performance, used to create, make predictions, and track statistics for models so that implementing a bunch of them doesn't become too wordy!

WindowBuilder

Used to take input data and transform it into the Windowed shapes that the TensorFlow models are expecting.

Class is initially set up to seed the initial windows to average values for each feature. (Likely will need to be changed.)

WindowBuilder can be used to assess (1) models when their predictions are fed in as past input, (2) models that receive ground truth.

PredictorEngine

An abstract class that can be used to pull in any TensorFlow model (used for both the CNN-BiDirectional LSMT, and various transformer models in this simulation).

PredictionLogger

Used to save model prediction in predictions.csv.

PerformanceLogger

Like PredictionLogger but it's used to track time of prediction in microseconds and power prediction. However, power prediction is sort of rough at the moment since it uses a general model coefficient that was pulled from python code monitoring overall monitor performance using nvidia-smi.

I want to get it so power prediction is actually monitoring the power during prediction.

To run

  1. Navigate to folder where pom.xml is located

  2. Run mvn clean install and mvn clean compile to install packages

  3. Run mvn exec:java -Dexec.mainClass="com.example.App" to run program

Currently, the program prints a summary and also creates a predictions.csv file of each model and its predictions (in addition to the ground truth).

After predictions.csv is created, simulation_compare.ipynb can be run to pull in and assess model performance (make sure pandas, numpy, and scikit learn are installed in the python environment used to run the notebook).

About

[CSUN-REU] Hooking python models up to Java to make predictions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages