run neuralnetwork to train mnist
신경망을 직접 구현하고, mnist 데이터셋을 학습시킵니다.
- NeuralNetwork with Python : https://github.com/hhkwon/NeuralNetwork
Python 3.6
- Raw Data
- mnist_test.csv ( mnist test set )
- mnist_train.csv ( mnist train set )
-
Sourcing Raw Data
-
Pre-processing
- inputs = (np.asfarray(all_values[1:]) / 255.0 * 0.99) + 0.01
-
Modeling (Update Weight)
- inputs = np.array(inputs_list, ndmin=2).T
- targets = np.array(targets_list, ndmin=2).T
- (hidden_inputs, hidden_outputs), (final_inputs, final_outputs)
- output_errors = targets - final_outputs,
- hidden_errors = np.dot(self.who.T, output_errors)
- self.who +=
self.learning_rate
* np.dot((output_errors
*final_outputs
*(1.0 - final_outputs)
),np.transpose(hidden_outputs)
) - self.wih +=
self.learning_rate
* np.dot((hidden_errors
*hidden_outputs
*(1.0 - hidden_outputs)
),np.transpose(inputs)
)
-
Output Sharing
- correct_label = int(
all_values[0]
) - label = np.argmax(
outputs
) - scorecard_array = np.asarray(
scorecard
) - print("performance = ",
scorecard_array.sum()
/scorecard_array.size
)
- correct_label = int(
`PYTHON`
import numpy as np
import matplotlib.pyplot as plt
import scipy.special
- 0.0.1
- First Commit (2019/02/02)