Datasets:
Upload 4 files
Browse files- README.md +3 -0
- build_dataset.py +196 -0
- data.zip +3 -0
- file_list.json +1 -0
README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EMBER 2018 Malware Analysis Dataset<br>
|
| 2 |
+
|
| 3 |
+
Visit https://github.com/elastic/ember for more information on the dataset
|
build_dataset.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
import json
|
| 17 |
+
import os
|
| 18 |
+
|
| 19 |
+
import datasets
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_file_list():
|
| 23 |
+
file_list = []
|
| 24 |
+
with open("./file_list.json") as f:
|
| 25 |
+
file_list = json.load(f)
|
| 26 |
+
return file_list
|
| 27 |
+
|
| 28 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
| 29 |
+
_CITATION = """\
|
| 30 |
+
@InProceedings{huggingface:dataset,
|
| 31 |
+
title = {Ember2018},
|
| 32 |
+
author={huggingface, Inc.
|
| 33 |
+
},
|
| 34 |
+
year={2023}
|
| 35 |
+
}
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
# TODO: Add description of the dataset here
|
| 39 |
+
# You can copy an official description
|
| 40 |
+
_DESCRIPTION = """\
|
| 41 |
+
This new dataset is from the EMBER 2018 dataset
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
# TODO: Add a link to an official homepage for the dataset here
|
| 45 |
+
_HOMEPAGE = "https://github.com/elastic/ember"
|
| 46 |
+
|
| 47 |
+
# TODO: Add the licence for the dataset here if you can find it
|
| 48 |
+
_LICENSE = ""
|
| 49 |
+
|
| 50 |
+
# TODO: Add link to the official dataset URLs here
|
| 51 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 52 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 53 |
+
_URLS = {
|
| 54 |
+
"first_domain": "./data.zip"
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
| 59 |
+
class NewDataset(datasets.GeneratorBasedBuilder):
|
| 60 |
+
"""TODO: Short description of my dataset."""
|
| 61 |
+
|
| 62 |
+
VERSION = datasets.Version("1.1.0")
|
| 63 |
+
|
| 64 |
+
# This is an example of a dataset with multiple configurations.
|
| 65 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
| 66 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
| 67 |
+
|
| 68 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
| 69 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
| 70 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
| 71 |
+
|
| 72 |
+
# You will be able to load one or the other configurations in the following list with
|
| 73 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
| 74 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 75 |
+
BUILDER_CONFIGS = [
|
| 76 |
+
datasets.BuilderConfig(name="first_domain", version=VERSION, description="This part of my dataset covers a first domain"),
|
| 77 |
+
datasets.BuilderConfig(name="second_domain", version=VERSION, description="This part of my dataset covers a second domain"),
|
| 78 |
+
]
|
| 79 |
+
|
| 80 |
+
DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 81 |
+
|
| 82 |
+
def _info(self):
|
| 83 |
+
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
| 84 |
+
if self.config.name == "first_domain": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 85 |
+
features = datasets.Features(
|
| 86 |
+
{
|
| 87 |
+
"x": datasets.features.Sequence(
|
| 88 |
+
datasets.Value("float32")
|
| 89 |
+
),
|
| 90 |
+
"y": datasets.Value("float32"),
|
| 91 |
+
"appeared": datasets.Value("string"),
|
| 92 |
+
"avclass": datasets.Value("string"),
|
| 93 |
+
"label": datasets.Value("string"),
|
| 94 |
+
"subset": datasets.Value("string"),
|
| 95 |
+
"sha256": datasets.Value("string")
|
| 96 |
+
}
|
| 97 |
+
)
|
| 98 |
+
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
| 99 |
+
features = datasets.Features(
|
| 100 |
+
{
|
| 101 |
+
"x": datasets.features.Sequence(
|
| 102 |
+
datasets.Value("float32")
|
| 103 |
+
),
|
| 104 |
+
"y": datasets.Value("float32"),
|
| 105 |
+
"appeared": datasets.Value("string"),
|
| 106 |
+
"avclass": datasets.Value("string"),
|
| 107 |
+
"label": datasets.Value("string"),
|
| 108 |
+
"subset": datasets.Value("string"),
|
| 109 |
+
"sha256": datasets.Value("string")
|
| 110 |
+
}
|
| 111 |
+
)
|
| 112 |
+
return datasets.DatasetInfo(
|
| 113 |
+
# This is the description that will appear on the datasets page.
|
| 114 |
+
description=_DESCRIPTION,
|
| 115 |
+
# This defines the different columns of the dataset and their types
|
| 116 |
+
features=features, # Here we define them above because they are different between the two configurations
|
| 117 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 118 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 119 |
+
# supervised_keys=("sentence", "label"),
|
| 120 |
+
# Homepage of the dataset for documentation
|
| 121 |
+
homepage=_HOMEPAGE,
|
| 122 |
+
# License for the dataset if available
|
| 123 |
+
license=_LICENSE,
|
| 124 |
+
# Citation for the dataset
|
| 125 |
+
citation=_CITATION,
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
def _split_generators(self, dl_manager):
|
| 129 |
+
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 130 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 131 |
+
|
| 132 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 133 |
+
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 134 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 135 |
+
urls = _URLS[self.config.name]
|
| 136 |
+
data_dir = dl_manager.download_and_extract(urls)
|
| 137 |
+
file_list = get_file_list()
|
| 138 |
+
return [
|
| 139 |
+
datasets.SplitGenerator(
|
| 140 |
+
name=datasets.Split.TRAIN,
|
| 141 |
+
# These kwargs will be passed to _generate_examples
|
| 142 |
+
gen_kwargs={
|
| 143 |
+
"filepaths": [os.path.join(data_dir, f"data/{file}") for file in file_list["train"]],
|
| 144 |
+
"split": "train",
|
| 145 |
+
},
|
| 146 |
+
),
|
| 147 |
+
# datasets.SplitGenerator(
|
| 148 |
+
# name=datasets.Split.VALIDATION,
|
| 149 |
+
# # These kwargs will be passed to _generate_examples
|
| 150 |
+
# gen_kwargs={
|
| 151 |
+
# "filepath": [os.path.join(data_dir, f"data/{file}") for file in file_list["dev"]],
|
| 152 |
+
# "split": "dev",
|
| 153 |
+
# },
|
| 154 |
+
# ),
|
| 155 |
+
datasets.SplitGenerator(
|
| 156 |
+
name=datasets.Split.TEST,
|
| 157 |
+
# These kwargs will be passed to _generate_examples
|
| 158 |
+
# [os.path.join(data_dir, file) for file in file_list["test"]],
|
| 159 |
+
gen_kwargs={
|
| 160 |
+
"filepaths": [os.path.join(data_dir, f"data/{file}") for file in file_list["test"]],
|
| 161 |
+
"split": "test"
|
| 162 |
+
},
|
| 163 |
+
),
|
| 164 |
+
]
|
| 165 |
+
|
| 166 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 167 |
+
def _generate_examples(self, filepaths, split):
|
| 168 |
+
key = 0
|
| 169 |
+
for path in filepaths:
|
| 170 |
+
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 171 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 172 |
+
with open(path, encoding="utf-8") as f:
|
| 173 |
+
data_list = json.load(f)
|
| 174 |
+
for data in data_list["data"]:
|
| 175 |
+
key += 1
|
| 176 |
+
if self.config.name == "first_domain":
|
| 177 |
+
# Yields examples as (key, example) tuples
|
| 178 |
+
yield key, {
|
| 179 |
+
"x": data["x"],
|
| 180 |
+
"y": data["y"],
|
| 181 |
+
"appeared": data["appeared"],
|
| 182 |
+
"avclass": data["avclass"],
|
| 183 |
+
"label": data["label"],
|
| 184 |
+
"subset": data["subset"],
|
| 185 |
+
"sha256": data["sha256"]
|
| 186 |
+
}
|
| 187 |
+
else:
|
| 188 |
+
yield key, {
|
| 189 |
+
"x": data["x"],
|
| 190 |
+
"y": data["y"],
|
| 191 |
+
"appeared": data["appeared"],
|
| 192 |
+
"avclass": data["avclass"],
|
| 193 |
+
"label": data["label"],
|
| 194 |
+
"subset": data["subset"],
|
| 195 |
+
"sha256": data["sha256"]
|
| 196 |
+
}
|
data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bd4647626eaa106715150ccf876ed428fd311a7ac9f9bdd19c22da1bf2b9170
|
| 3 |
+
size 4855764817
|
file_list.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"train": ["ember2018_train_1.jsonl", "ember2018_train_2.jsonl", "ember2018_train_3.jsonl", "ember2018_train_4.jsonl", "ember2018_train_5.jsonl", "ember2018_train_6.jsonl", "ember2018_train_7.jsonl", "ember2018_train_8.jsonl", "ember2018_train_9.jsonl", "ember2018_train_10.jsonl", "ember2018_train_11.jsonl", "ember2018_train_12.jsonl", "ember2018_train_13.jsonl", "ember2018_train_14.jsonl", "ember2018_train_15.jsonl", "ember2018_train_16.jsonl", "ember2018_train_17.jsonl", "ember2018_train_18.jsonl", "ember2018_train_19.jsonl", "ember2018_train_20.jsonl", "ember2018_train_21.jsonl", "ember2018_train_22.jsonl", "ember2018_train_23.jsonl", "ember2018_train_24.jsonl", "ember2018_train_25.jsonl", "ember2018_train_26.jsonl", "ember2018_train_27.jsonl", "ember2018_train_28.jsonl", "ember2018_train_29.jsonl", "ember2018_train_30.jsonl", "ember2018_train_31.jsonl", "ember2018_train_32.jsonl", "ember2018_train_33.jsonl", "ember2018_train_34.jsonl", "ember2018_train_35.jsonl", "ember2018_train_36.jsonl", "ember2018_train_37.jsonl", "ember2018_train_38.jsonl", "ember2018_train_39.jsonl", "ember2018_train_40.jsonl", "ember2018_train_41.jsonl", "ember2018_train_42.jsonl", "ember2018_train_43.jsonl", "ember2018_train_44.jsonl", "ember2018_train_45.jsonl", "ember2018_train_46.jsonl", "ember2018_train_47.jsonl", "ember2018_train_48.jsonl", "ember2018_train_49.jsonl", "ember2018_train_50.jsonl", "ember2018_train_51.jsonl", "ember2018_train_52.jsonl", "ember2018_train_53.jsonl", "ember2018_train_54.jsonl", "ember2018_train_55.jsonl", "ember2018_train_56.jsonl", "ember2018_train_57.jsonl", "ember2018_train_58.jsonl", "ember2018_train_59.jsonl", "ember2018_train_60.jsonl", "ember2018_train_61.jsonl", "ember2018_train_62.jsonl", "ember2018_train_63.jsonl", "ember2018_train_64.jsonl", "ember2018_train_65.jsonl", "ember2018_train_66.jsonl", "ember2018_train_67.jsonl", "ember2018_train_68.jsonl", "ember2018_train_69.jsonl", "ember2018_train_70.jsonl", "ember2018_train_71.jsonl", "ember2018_train_72.jsonl", "ember2018_train_73.jsonl", "ember2018_train_74.jsonl", "ember2018_train_75.jsonl", "ember2018_train_76.jsonl", "ember2018_train_77.jsonl", "ember2018_train_78.jsonl", "ember2018_train_79.jsonl", "ember2018_train_80.jsonl"], "test": ["ember2018_test_1.jsonl", "ember2018_test_2.jsonl", "ember2018_test_3.jsonl", "ember2018_test_4.jsonl", "ember2018_test_5.jsonl", "ember2018_test_6.jsonl", "ember2018_test_7.jsonl", "ember2018_test_8.jsonl", "ember2018_test_9.jsonl", "ember2018_test_10.jsonl", "ember2018_test_11.jsonl", "ember2018_test_12.jsonl", "ember2018_test_13.jsonl", "ember2018_test_14.jsonl", "ember2018_test_15.jsonl", "ember2018_test_16.jsonl", "ember2018_test_17.jsonl", "ember2018_test_18.jsonl", "ember2018_test_19.jsonl", "ember2018_test_20.jsonl"]}
|