Search code examples
datasetdeep-learningkerasautoencoder

Using Autoencoder on numerical dataset in Keras


I am trying to develop an Intrusion Detection System based on deep learning using Keras.

We simulated a NORMAL network traffic and I prepared it in CSV file (numerical dataset of network packets fields (IP source, port,etc..)). But I do not have the ABNORMAL (malicious) packets to train the neural network on.

I searched for problems like that and I found that Autoencoder is a good approach in unsupervised learning, but the thing is that I am new to deep learning, and I only found this example https://blog.keras.io/building-autoencoders-in-keras.html where they are using Autoencoder on images dataset.

I want to use Autoencoder (or any thing useful in my case) with numerical CSV dataset in order to predict if the incoming packet is normal or malicious.

Any recommendation?


Solution

  • I have found the answer:

    You can load the numerical dataset into python using e.g. numpy load text. Then, specify the encoder and decoder networks (basically just use the Keras Layers modules to design neural networks). Make sure the input layer of the encoder accepts your data, and the output layer of the decoder has the same dimension. Then, specify appropriate loss function (least squares, cross entropy, etc’) again with Keras losses. Finally, specify your optimizer with (surprise!) Keras optimizers.

    Thats it, your done! Hit ‘run’, and watch your autoencoder autoencode (because that is how the autoencoders do). If you want a great tutorial about how to construct this.