harpomaxx commited on
Commit
13485a3
1 Parent(s): 97aeeec

Upload dga-detector.py

Browse files
Files changed (1) hide show
  1. dga-detector.py +49 -0
dga-detector.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import GeneratorBasedBuilder, DownloadConfig, SplitGenerator, SplitInfo, DatasetInfo
2
+ import pandas as pd
3
+ import os
4
+
5
+
6
+ class MyDataset(GeneratorBasedBuilder):
7
+ def _info(self):
8
+
9
+ return datasets.DatasetInfo(
10
+ description="DESCRIPTION",
11
+ features=datasets.Features(
12
+ {"domain": datasets.Value("string"), "label": datasets.Value("string")}
13
+ ),
14
+ supervised_keys=("domain", "label"),
15
+ homepage="_HOMEPAGE",
16
+ )
17
+
18
+
19
+ def _split_generators(self, dl_manager: DownloadConfig):
20
+ # Load your local dataset file
21
+ csv_path = "/mnt/git-repos/deepDGAgen/rawdata/argencon.csv.gz"
22
+
23
+ return [
24
+ SplitGenerator(
25
+ name=split,
26
+ gen_kwargs={
27
+ "filepath": csv_path,
28
+ "split": split,
29
+ },
30
+ )
31
+ for split in ["train", "test", "validation"]
32
+ ]
33
+
34
+ def _generate_examples(
35
+ self,
36
+ filepath: str,
37
+ split: str,
38
+ ):
39
+ # Read your CSV dataset
40
+ dataset = pd.read_csv(filepath)
41
+
42
+ # You can filter or split your dataset based on the 'split' argument if necessary
43
+
44
+ # Generate examples
45
+ for index, row in dataset.iterrows():
46
+ yield index, {
47
+ "domain": row["domain"],
48
+ "label": row["label"],
49
+ }