Skip to content

evaluate.py

michele edited this page Oct 13, 2021 · 8 revisions

In this page

Imported Modules


  • import baker - easy, powerful access to Python functions from the command line - baker documentation
  • import mlflow - open source platform for managing the end-to-end machine learning lifecycle - mlflow documentation
  • import pandas as pd - pandas is a flexible and easy to use open source data analysis and manipulation tool - pandas documentation
  • import torch - tensor library like NumPy, with strong GPU support - pytorch documentation
  • from logzero import logger - robust and effective logging for Python - logzero documentation
  • from tqdm import tqdm - instantly makes loops show a smart progress meter - tqdm documentation

Back to top

Classes and functions

import_modules(net_type, gen_type) (function) - Dynamically import network, dataset and generator modules depending on the provided arguments.

  • net_type (arg) - Network type (possible values: mtje, mtje_cosine, mtje_pairwise_distance, aloha)
  • gen_type (arg) - Generator type (possible values: base, alt1, alt2, alt3)

evaluate_network(ds_path, checkpoint_file, net_type, gen_type, batch_size, test_n_samples, evaluate_malware, evaluate_count, evaluate_tags, feature_dimension) (function, baker command) - Take a trained feedforward neural network model and output evaluation results to a csv file.

  • ds_path (arg) - Path of the directory where to find the pre-processed dataset (containing .dat files)
  • checkpoint_file (arg) - The checkpoint file containing the weights to evaluate
  • net_type (arg) - Network to use between 'mtje', 'mtje_cosine', 'mtje_pairwise_distance' and 'aloha' (default: 'mtje')
  • gen_type (arg) - Generator (and dataset) class to use between 'base', 'alt1', 'alt2', 'alt3'. (default: 'base')
  • batch_size (arg) - How many samples per batch to load (default: 8192)
  • test_n_samples (arg) - Number of test samples to consider (used to access the right files) (default: 0 -> all)
  • evaluate_malware (arg) - Whether (1/0) to record malware labels and predictions (default: 1)
  • evaluate_count (arg) - Whether (1/0) to record count labels and predictions (default: 1)
  • evaluate_tags (arg) - Whether (1/0) to use SMART tags as additional targets (default: 1)
  • feature_dimension (arg) - The input dimension of the model (default: 2381)

__main__ (main) - Start baker in order to make it possible to run the script and use function names and parameters as the command line interface, using optparse-style options


Back to top