-
Notifications
You must be signed in to change notification settings - Fork 2
Family_Classifier_net.py
michele edited this page Oct 13, 2021
·
2 revisions
-
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
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)
-
root/ | ├── src/ | | | ├── FreshDatasetBuilder/ | | | | | ├── emberFeatures/ | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── features.py - - - - - - - - - - - - - - - (features python code 📖Wiki) | | | └── vectorize_features.py - - - - - - - - - - (vectorize features python code 📖Wiki) | | | | | ├── utils/ | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── fresh_dataset_utils.py - - - - - - - - - - (fresh dataset utils python code 📖Wiki) | | | └── malware_bazaar_api.py - - - - - - - - - - (malware bazaar API python code 📖Wiki) | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | └── build_fresh_dataset.py - - - - - - - - - - (fresh dataset builder python code 📖Wiki) | | | ├── Model/ | | | | | ├── nets/ | | | | | | | ├── generators/ | | | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | | ├── dataset.py - - - - - - - - - - - - - - - - (dataset (base) code 📖Wiki) | | | | ├── dataset_alt.py - - - - - - - - - - - - - - (dataset_alt code 📖Wiki) | | | | ├── fresh_dataset.py - - - - - - - - - - - - - (fresh_dataset code 📖Wiki) | | | | ├── fresh_generators.py - - - - - - - - - - - (fresh_generators code 📖Wiki) | | | | ├── generators.py - - - - - - - - - - - - - - (generators (base) code 📖Wiki) | | | | ├── generators_alt1.py - - - - - - - - - - - - (generators_alt1 code 📖Wiki) | | | | ├── generators_alt2.py - - - - - - - - - - - - (generators_alt2 code 📖Wiki) | | | | └── generators_alt3.py - - - - - - - - - - - - (generators_alt3 code 📖Wiki) | | | | | | | ├── utils/ | | | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | | └── Net.py - - - - - - - - - - - - - - - - - - (Net code 📖Wiki) | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── ALOHA_net.py - - - - - - - - - - - - - - - (ALOHA_net code 📖Wiki) | | | ├── Contrastive_Model_net.py - - - - - - - - - (Contrastive_Model_net code 📖Wiki) | | | ├── Family_Classifier_net.py - - - - - - - - - (Family_Classifier_net code 📖Wiki) | | | ├── MTJE_net.py - - - - - - - - - - - - - - - (MTJE_net code 📖Wiki) | | | ├── MTJE_net_cosine.py - - - - - - - - - - - - (MTJE_net_cosine code 📖Wiki) | | | └── MTJE_net_pairwise_distance.py - - - - - - (MTJE_net_pairwise_distance code 📖Wiki) | | | | | ├── utils/ | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── contrastive_utils.py - - - - - - - - - - - (contrastive_utils code 📖Wiki) | | | ├── opt_utils.py - - - - - - - - - - - - - - - (opt_utils code 📖Wiki) | | | ├── plot_utils.py - - - - - - - - - - - - - - (plot_utils code 📖Wiki) | | | └── ranking_metrics.py - - - - - - - - - - - - (ranking_metrics code 📖Wiki) | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | ├── evaluate.py - - - - - - - - - - - - - - - (evaluate code 📖Wiki) | | ├── evaluate_contrastive.py - - - - - - - - - (evaluate_contrastive code 📖Wiki) | | ├── evaluate_family_classifier.py - - - - - - (evaluate_family_classifier code 📖Wiki) | | ├── evaluate_fresh.py - - - - - - - - - - - - (evaluate_fresh code 📖Wiki) | | ├── gen3_speed_evaluation.py - - - - - - - - - (gen3_speed_evaluation code 📖Wiki) | | ├── plot.py - - - - - - - - - - - - - - - - - (plot code 📖Wiki) | | ├── plot_contrastive.py - - - - - - - - - - - (plot_contrastive code 📖Wiki) | | ├── plot_family_classifier.py - - - - - - - - (plot_family_classifier code 📖Wiki) | | ├── plot_fresh.py - - - - - - - - - - - - - - (plot_fresh code 📖Wiki) | | ├── train.py - - - - - - - - - - - - - - - - - (train code 📖Wiki) | | ├── train_contrastive.py - - - - - - - - - - - (train_contrastive code 📖Wiki) | | └── train_family_classifier.py - - - - - - - - (train_family_classifier code 📖Wiki) | | | ├── Sorel20mDataset/ | | | | | ├── generators/ | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── sorel_dataset.py - - - - - - - - - - - - - (sorel_dataset code 📖Wiki) | | | └── sorel_generators.py - - - - - - - - - - - (sorel_generators code 📖Wiki) | | | | | ├── utils/ | | | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | | ├── download_utils.py - - - - - - - - - - - - (download_utils code 📖Wiki) | | | └── preproc_utils.py - - - - - - - - - - - - - (preproc_utils code 📖Wiki) | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | ├── preprocess_dataset.py - - - - - - - - - - (preprocess_dataset code 📖Wiki) | | ├── preprocess_ds_multi.py - - - - - - - - - - (preprocess_ds_multi code 📖Wiki) | | └── sorel20mDownloader.py - - - - - - - - - - (sorel20mDownloader code 📖Wiki) | | | ├── utils/ | | | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | | └── workflow_utils.py - - - - - - - - - - - - - - - - - (workflow_utils code 📖Wiki) | | | ├── __init__.py - - - - - - - - - - - - - - - (python module init) | ├── config.ini - - - - - - - - - - - - - - - - (configuration file 📖Wiki) | └── main.py - - - - - - - - - - - - - - - - - (main code 📖Wiki) | ├── MLproject - - - - - - - - - - - - - - - - (MLproject file) ├── README.md - - - - - - - - - - - - - - - - (README) └── conda.yaml - - - - - - - - - - - - - - - - (conda yaml environment)