What Is NN CalculatorΒΆ

Neural network calculator (NN Calculator) is an interactive visualization of neural networks that operates on datasets and NN coefficients as opposed to simple numbers.

For more information how the NN Calculator can be used for designing trojan detector, see the paper:
Peter Bajcsy, Nicholas J. Schaub, Michael Majurski, Neural Network Calculator for Designing Trojan Detectors, arXiv:2006.03707v1 [cs.CR] 5 Jun 2020; PDF version.

The GitHub deployment and repositories of Neural Network Calculator can be found at:

Main features

The image below shows a layout of the main functionalities in NN Calculator.

Fig. 1: Neural Network Calculator Interface

The standard calculator symbols MC, MR, M+, M-, and MS are used for clearing, retrieving, adding, subtracting, and setting memory with datasets (training and testing subsets) and NN coefficients (biases and weights) with preceding D or NN. In addition, the datasets can be modified by adding multiple levels of noise or nine embedding types of trojans, and NNs can be modified by constructing layers and nodes or manually changing coefficients. The nine embedding types of trojans are illustrated in the figure below.

Fig. 2: Illustrations of nine embedding types of trojans (T1-T9) in four patterns

The main operations on datasets and NN are train, inference, inefficiency, and robustness calculations with their corresponding mean squared error (MSE) for training, testing and inference sub-sets, neuron state histograms, and derived measurement statistics. Furthermore, one can perform NN model averaging and dataset regeneration in order to study variability over multiple training sessions and random data perturbations.

The remaining settings are viewed as characteristics of datasets (noise, trojan), parameters of NN modeling algorithm (Learning Rate, Activation Function, Regularization, Regularization Rate), and parameters of NN training algorithm (Train to Test Ratio, Batch Size). In order to keep track of all settings, one can save all NN parameters and NN coefficients, as well as all inefficiency and robustness analytical results.

The inefficiency calculation is defined via modified Kullback-Liebler (KL) divergence applied to a state histogram extracted per layer and per class label. NN Calculator reports also the number of non-zero histogram bins per class, the states and their counts per layer and per label for most and least frequently occurring states, the number of overlapping states across class labels and their corresponding states, and the bits in states that are constant for all used states for predicting a class label. The robustness calculation computes average and standard deviation of inefficiency values acquired over three runs and 100 epochs per run.