# Neural network does not give out the required out put?

Made a neural network using tensor flows that was supposed matches an Ip to one of the 7 type of vulnerabilities and gives out what type of vulnerability that IP has.

    model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(50, activation=tf.nn.relu),
tf.keras.layers.Dense(7, activation=tf.nn.softmax)
])

loss='sparse_categorical_crossentropy',
metrics=['accuracy'])

model.fit(xs, ys, epochs=500)


The output of print(model.predict([181271844])) when this command is executed should be one of the numbers from 1 to 7 but the out put its gives is

[[0.22288103 0.20282331 0.36847615 0.11339897 0.04456346 0.02391759 0.02393949]]

I can't seem to figure out what the problem is.

• xs is the list of IPs and ys is its corrensponding vulnerability from 0 to 6 (seven in total) – Uzair Ahmed Sep 19 '19 at 20:17
• Preprocessing means to convert input signals into a range of [0..1]. A basic strategy would be to convert the decimal values of the IP6 adress-range into binary digits. A more elaborated heuristic would put extra knowledge into the conversation process and decides, if the ip-address comes from a certain list. – Manuel Rodriguez Sep 19 '19 at 20:34
• @ManuelRodriguez I have already done that, but still thanks for the help – Uzair Ahmed Sep 20 '19 at 14:13

The numbers you are seeing as output are a probability vector. This is a common output format for multi-class classification models.

In this case, you can interpret the vector as saying:

• 22% chance of class 1
• 20% chance of class 2
• 37% chance of class 3
• 11% chance of class 4
• 4% chance of class 5
• 2% chance of class 6
• 2% chance of class 7

If you want to get a concrete label out of this, the easiest choice is to compute and return the index of the maximum element.