Skip to content

Family_Classifier_net.py

michele edited this page Oct 13, 2021 · 2 revisions

In this page

Imported Modules

  • import configparser - implements a basic configuration language for Python programs - configparser documentation
  • import os - provides a portable way of using operating system dependent functionality - os documentation

  • from torch import nn - a neural network library deeply integrated with autograd designed for maximum flexibility - torch.nn documentation

  • from .utils.Net import Net as baseNet

Back to top

Classes and functions

Net (class) - Family Classifier Network built using the MTJE model as base.

  • __init__(self, families, feature_dimension, embedding_dimension, layer_sizes, fam_class_layer_sizes, dropout_p, activation_function, normalization_function) (member function) - Initialize net.
    • families (arg) - List of families to predict
    • feature_dimension (arg) - Dimension of the input data feature vector (default: 2381)
    • embedding_dimension (arg) - Joint latent space size (default: 32)
    • layer_sizes (arg) - Layer sizes (array of sizes) (default: None -> use [512, 512, 128])
    • fam_class_layer_sizes (arg) - Layer sizes (array of sizes) for the family classifier (default: None -> use [64, 32])
    • dropout_p (arg) - Dropout probability (default: 0.05)
    • activation_function (arg) - Non-linear activation function to use (may be "elu", "leakyRelu", "pRelu" or "relu") (default: "elu")
    • normalization_function (arg) - Normalization function to use (may be "layer_norm" or "batch_norm") (default: "batch_norm")
  • forward(self, data) (member function) - Forward batch of data through the net.
    • data (arg) - Current batch of data (features)
  • compute_loss(predictions, labels, loss_wts) (static member function) - Compute Net loss.
    • predictions (arg) - A dictionary of results from the Net
    • labels (arg) - A dictionary of labels
    • loss_wts (arg) - Unused (default: None)
  • normalize_results(labels, predicted_probabilities, use_malware, use_count, use_tags) (static member function) - Take a set of results dicts and break them out into a single dict of 1d arrays with appropriate column names that pandas can convert to a DataFrame.
    • labels (arg) - Labels (ground truth)
    • predicted_probabilities (arg) - Family probabilities predicted by the model
    • use_malware (arg) - Whether to use malware/benignware labels as a target (default: False)
    • use_count (arg) - Whether to use the counts as an additional target (default: False)
    • use_tags (arg) - Whether to use SMART tags as additional targets (default: False)

Back to top