rdpahalavan commited on
Commit
ab805a6
1 Parent(s): 77d6a56

Delete CIC-IDS2017.py

Browse files
Files changed (1) hide show
  1. CIC-IDS2017.py +0 -62
CIC-IDS2017.py DELETED
@@ -1,62 +0,0 @@
1
- """CIC-IDS2017"""
2
-
3
- import os
4
- import pyarrow.parquet as pq
5
- import datasets
6
-
7
- _DESCRIPTION = ""
8
-
9
- _HOMEPAGE = ""
10
-
11
- _URLS = {
12
- "Network-Flows": "Network-Flows/CICIDS_Flow.parquet",
13
- "Packet-Bytes": "Packet-Bytes/Packet_Bytes_File_1.parquet",
14
- "Packet-Fields": "Packet-Fields/Packet_Fields_File_1.parquet",
15
- "Payload-Bytes": "Payload-Bytes/Payload_Bytes_File_1.parquet",
16
- }
17
-
18
- class NewDataset(datasets.GeneratorBasedBuilder):
19
- VERSION = datasets.Version("1.0.0")
20
-
21
- BUILDER_CONFIGS = [
22
- datasets.BuilderConfig(name="Network-Flows", version=VERSION, description="Network-Flows"),
23
- datasets.BuilderConfig(name="Packet-Bytes", version=VERSION, description="Packet-Bytes"),
24
- datasets.BuilderConfig(name="Packet-Fields", version=VERSION, description="Packet-Fields"),
25
- datasets.BuilderConfig(name="Payload-Bytes", version=VERSION, description="Payload-Bytes"),
26
- ]
27
-
28
- DEFAULT_CONFIG_NAME = "Network-Flows"
29
-
30
- def _info(self):
31
- # infer features directly from Parquet file schema
32
- parquet_file = pq.ParquetFile(_URLS[self.config.name])
33
- schema = parquet_file.schema
34
- # Only take the first 1000 fields
35
- limited_schema = pa.schema(schema[:1000])
36
- features = datasets.Features.from_arrow_schema(limited_schema)
37
- return datasets.DatasetInfo(
38
- description=_DESCRIPTION,
39
- features=features,
40
- homepage=_HOMEPAGE,
41
- )
42
-
43
- def _split_generators(self, dl_manager):
44
- url = _URLS[self.config.name]
45
- downloaded_file = dl_manager.download_and_extract(url)
46
- return [
47
- datasets.SplitGenerator(
48
- name=datasets.Split.TRAIN,
49
- gen_kwargs={
50
- "filepath": downloaded_file,
51
- },
52
- ),
53
- ]
54
-
55
- def _generate_examples(self, filepath):
56
- parquet_file = pq.ParquetFile(filepath)
57
- for row_index in range(parquet_file.num_row_groups):
58
- row_group = parquet_file.read_row_group(row_index)
59
- # Convert to pandas DataFrame, select first 1000 columns and convert to dictionary
60
- df = row_group.to_pandas()
61
- selected_columns = df.iloc[:, :1000]
62
- yield row_index, selected_columns.to_dict('records')[0]