Answers.Body: <p>The numbers you are seeing as output are a <em>probability vector</em>. This is a common output format for multi-class classification models.</p>
  
  <p>In this case, you can interpret the vector as saying:</p>
  
  <ul>
  <li>22% chance of class 1</li>
  <li>20% chance of class 2</li>
  <li>37% chance of class 3</li>
  <li>11% chance of class 4</li>
  <li>4% chance of class 5</li>
  <li>2% chance of class 6</li>
  <li>2% chance of class 7</li>
  </ul>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-19T23:38:04.110Z
Answers.LastActivityDate: 2019-09-19T23:38:04.110Z
Answers.UserDisplayName: John Doucette
Body: <p>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.</p>
  
  <hr>
  
  <pre><code>    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)
  ])
  
  model.compile(optimizer='adam',
                loss='sparse_categorical_crossentropy',
                metrics=['accuracy'])
  
  
  
  model.fit(xs, ys, epochs=500)
  </code></pre>
  
  <p>The output of <code>print(model.predict([181271844]))</code> when this command is executed should be one of the numbers from 1 to 7 but the out put its gives is </p>
  
  <blockquote>
    <p>[[0.22288103 0.20282331 0.36847615 0.11339897 0.04456346 0.02391759
      0.02393949]]</p>
  </blockquote>
  
  <p>I can't seem to figure out what the problem is.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-19T20:17:04.907Z
Comments.Text: xs is the list of IPs and ys is its corrensponding vulnerability from 0 to 6 (seven in total)
Comments.UserDisplayName: Uzair Ahmed
Tags: <neural-networks><tensorflow>
Title: Neural network does not give out the required out put?
UserDisplayName: Uzair Ahmed
ThreadText: # Neural network does not give out the required out put?
  
  (Asked by: username_0 on 2019-09-19)
  
  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)
  ])
  
  model.compile(optimizer='adam',
                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.
  
  **Tags:** neural-networks, tensorflow
  > **Comments:**
  > **username_0**: xs is the list of IPs and ys is its corrensponding vulnerability from 0 to 6 (seven in total)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-09-19. Score: 1 | Accepted answer
  
  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.
  
  
  ---
  
  