dga-detection / dga-detector.py
harpomaxx's picture
Upload dga-detector.py
1f1712b
raw
history blame
1.38 kB
import datasets
import pandas as pd
import os
class MyDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
description="DESCRIPTION",
features=datasets.Features(
{"domain": datasets.Value("string"), "label": datasets.Value("string")}
),
supervised_keys=("domain", "label"),
homepage="_HOMEPAGE",
)
def _split_generators(self, dl_manager: DownloadConfig):
# Load your local dataset file
csv_path = "https://huggingface.co/datasets/harpomaxx/dga-detection/raw/main/argencon.csv.gz"
return [
datasets.SplitGenerator(
name=split,
gen_kwargs={
"filepath": csv_path,
"split": split,
},
)
for split in ["train", "test", "validation"]
]
def _generate_examples(
self,
filepath: str,
split: str,
):
# Read your CSV dataset
dataset = pd.read_csv(filepath)
# You can filter or split your dataset based on the 'split' argument if necessary
# Generate examples
for index, row in dataset.iterrows():
yield index, {
"domain": row["domain"],
"label": row["label"],
}