-
Notifications
You must be signed in to change notification settings - Fork 2
evaluate.py
michele edited this page Oct 13, 2021
·
8 revisions
-
import configparser
- implements a basic configuration language for Python programs - configparser documentation -
import importlib
- provides the implementation of the import statement in Python source code - importlib documentation -
import json
- json encoder and decoder - json documentation -
import os
- provides a portable way of using operating system dependent functionality - os documentation -
import tempfile
- used to create temporary files and directories - tempfile documentation
-
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
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
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)