Update dga-detection.py
Browse files- dga-detection.py +6 -2
dga-detection.py
CHANGED
@@ -19,7 +19,10 @@ class MyDataset(datasets.GeneratorBasedBuilder):
|
|
19 |
return datasets.DatasetInfo(
|
20 |
description=_DESCRIPTION,
|
21 |
features=datasets.Features(
|
22 |
-
{"domain": datasets.Value("string"),
|
|
|
|
|
|
|
23 |
),
|
24 |
supervised_keys=("domain", "label"),
|
25 |
homepage="_HOMEPAGE",
|
@@ -66,7 +69,7 @@ class MyDataset(datasets.GeneratorBasedBuilder):
|
|
66 |
):
|
67 |
# Read your CSV dataset
|
68 |
dataset = pd.read_csv(filepath,compression='gzip')
|
69 |
-
|
70 |
# Get the total number of rows
|
71 |
total_rows = len(dataset)
|
72 |
|
@@ -91,5 +94,6 @@ class MyDataset(datasets.GeneratorBasedBuilder):
|
|
91 |
yield index, {
|
92 |
"domain": row["domain"],
|
93 |
"label": row["label"],
|
|
|
94 |
}
|
95 |
|
|
|
19 |
return datasets.DatasetInfo(
|
20 |
description=_DESCRIPTION,
|
21 |
features=datasets.Features(
|
22 |
+
{"domain": datasets.Value("string"),
|
23 |
+
"label": datasets.Value("string"),
|
24 |
+
"class": datasets.Value("int")
|
25 |
+
}
|
26 |
),
|
27 |
supervised_keys=("domain", "label"),
|
28 |
homepage="_HOMEPAGE",
|
|
|
69 |
):
|
70 |
# Read your CSV dataset
|
71 |
dataset = pd.read_csv(filepath,compression='gzip')
|
72 |
+
dataset['class'] = dataset['label'].apply(lambda x: 0 if 'normal' in x else 1)
|
73 |
# Get the total number of rows
|
74 |
total_rows = len(dataset)
|
75 |
|
|
|
94 |
yield index, {
|
95 |
"domain": row["domain"],
|
96 |
"label": row["label"],
|
97 |
+
"class": row["class"],
|
98 |
}
|
99 |
|