Net.py - cmikke97/Automatic-Malware-Signature-Generation GitHub Wiki
-
import os- provides a portable way of using operating system dependent functionality - os documentation -
import re- provides regular expression matching operations - re documentation -
import tempfile- used to create temporary files and directories - tempfile documentation -
from copy import deepcopy- creates a new object and recursively copies the original object elements - copy documentation
-
import mlflow- open source platform for managing the end-to-end machine learning lifecycle - mlflow documentation -
import numpy as np- the fundamental package for scientific computing with Python - numpy documentation -
import torch- tensor library like NumPy, with strong GPU support - pytorch documentation -
from torch import nn- a neural network library deeply integrated with autograd designed for maximum flexibility - torch.nn documentation
Net (class) - Neural Network super class.
-
__init__(self)(member function) - Initialize net. -
forward(self, data)(abstract member function) - Forward batch of data through the net.-
data(arg) - Current batch of data (features)
-
-
save(self, epoch)(member function) - Saves model state dictionary to temp directory and then logs it.-
epoch(arg) - Current epoch
-
-
load(self, path)(member function) - Loads model checkpoint from current run artifacts, if it exists.-
path(arg) - Path where to (try) retrieve model checkpoint from
-
-
last_epoch_done(checkpoint_dir)(static member function) - Get last epoch completed by a previous run.-
checkpoint_dir(arg) - Path where to search the model state
-
-
compute_loss(predictions, labels, loss_wts)(abstract static member function) - Compute Net losses.-
predictions(arg) - A dictionary of results from the Net -
labels(arg) - A dictionary of labels -
loss_wts(arg) - Weights to assign to each head of the network (if it exists)
-
-
normalize_results(labels_dict, results_dict, use_malware, use_count, use_tags)(abstract 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_dict(arg) - Labels (ground truth) dictionary -
results_dict(arg) - Results (predicted labels) dictionary -
use_malware(arg) - Whether to use malware/benignware labels as a target -
use_count(arg) - Whether to use the counts as an additional target -
use_tags(arg) - Whether to use SMART tags as additional targets
-
-
detach_and_copy_array(array)(static member function) - Detach numpy array or pytorch tensor and return a deep copy of it.-
array(arg) - Numpy array or pytorch tensor to copy
-