深度学习NIDS论文复现:Deep Learing Approach for Network Intrusion Detection in Software Defined Networking

Title: Deep Learning Approach for Network Intrusion Detection in Software Defined Networking
Authors: Tuan A Tang, Lotfi Mhamdi, Des McLernon, Syed Ali Raza Zaidi and Mounir Ghogho
Published in: 2016 International Conference on Wireless Networks and Mobile Communications (WINCOM)

本文中的代码均用python实现

  • 摘要

  • 数据集
    使用的是NSL-KDD数据集,它是KDD cup 99数据集的改进版本。共有41个特征,分为基本特征、内容特征、流量统计特征三类。

  • 数据预处理
    包括将非数字特征表示为数字特征、数值归一化等。

import numpy as np
path ='KDDTrain+.txt'
#read txt dataset and convert it into numpy array
def read_as_array(path):
    arr = []
    f = open(path,'r')
    content = f.readlines()
    for item in content:
        arr.append(item.replace('\n','').split(','))
    arr = np.array(arr).T
    return arr
#transfor protocol feature into numerical values
def handleProtocol(arr):
    protocols=['tcp','udp','icmp']
    for i in range(0,len(arr[1])):
        arr[1][i] = protocols.index(arr[1][i])
#Min-Max scaling
def normalization(arr):
    for i in range(0,len(arr)):
        max_value = np.max(arr[i])
        min_value = np.min(arr[i])
        arr[i] = (arr[i] - min_value)/(max_value - min_value) 
train_set = read_as_array(path)
train_set = train_set[[0,1,4,5,22,23]]
handleProtocol(train_set)
train_set = train_set.astype(float)
normalization(train_set)
print(train_set)

(未完)

你可能感兴趣的:(基于深度学习的网络入侵检测,python,深度学习,网络入侵检测,论文复现)