|
@@ -0,0 +1,135 @@
|
|
|
|
+import numpy as np
|
|
|
|
+from nn import NeuralNetwork
|
|
|
|
+
|
|
|
|
+# _
|
|
|
|
+# | |
|
|
|
|
+# _
|
|
|
|
+# | |
|
|
|
|
+# _
|
|
|
|
+
|
|
|
|
+# 1
|
|
|
|
+# 2 3
|
|
|
|
+# 4
|
|
|
|
+# 5 6
|
|
|
|
+# 7
|
|
|
|
+
|
|
|
|
+nn = NeuralNetwork(input_layer_size=7, hidden_layer_size=16, output_layer_size=10)
|
|
|
|
+nn.load('test.npz')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.0, 0.0, 0.98, 0.0, 0.0, 0.99, 0.0] #1
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 1")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+test_data = [0.89, 0.0, 0.92, 0.97, 0.87, 0.0, 0.87] #2
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 2")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0] #3
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 3")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.08, 0.97, 0.98, 0.97, 0.0, 0.89, 0.12] #4
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 4")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.82, 0.97, 0.09, 0.97, 0.0, 0.89, 0.92] #5
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 5")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.82, 0.97, 0.09, 0.97, 0.89, 0.89, 0.92] #6
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 6")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+test_data = [0.82, 0.09, 0.92, 0.09, 0.08, 0.91, 0.07] #7
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 7")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.82, 0.97, 0.91, 0.97, 0.89, 0.89, 0.92] #8
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 8")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.82, 0.97, 0.91, 0.97, 0.08, 0.89, 0.92] #9
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 9")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.8, 1.0, 0.98, 0.0, 0.89, 0.89, 0.99] #0
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: 0")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.1, 0.12, 0.15, 0.05, 0.09, 0.098, 0.11] # Nothing
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: Nothing")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+test_data = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Nothing
|
|
|
|
+output = nn.get(test_data)
|
|
|
|
+print ("Test: Absolutely nothing :)")
|
|
|
|
+print (output)
|
|
|
|
+index = np.argmax(output)
|
|
|
|
+predict = np.argmax(output)+1
|
|
|
|
+confidence = round(output[0][index][0] * 100, 2)
|
|
|
|
+print (f'Predict: {predict}; Confidence: {confidence}%\r\n')
|