HolyFuckItsAlive #13

Merged
jastornig merged 105 commits from Delta-Error-Test into main 2023-09-23 22:27:54 +02:00
5 changed files with 108264 additions and 59 deletions
Showing only changes of commit 411e4db3db - Show all commits

12
main.c
View file

@ -11,17 +11,19 @@ int main() {
// matrix_print(images[0]->pixel_values);
// matrix_print(images[1]->pixel_values);
Neural_Network* nn = new_network(28*28, 32, 2, 10, 0.1);
Neural_Network* nn = new_network(28*28, 40, 5, 10, 0.08);
randomize_network(nn, 1);
// save_network(nn);
// Neural_Network* nn = load_network("../networks/test1.txt");
// Neural_Network* nn = load_network("../networks/newest_network.txt");
// printf("Done loading!\n");
// batch_train(nn, images, 20000, 20);
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < 30000; ++i) {
train_network(nn, images[i], images[i]->label);
}
printf("%lf\n", measure_network_accuracy(nn, images, 10));
save_network(nn);
printf("%lf\n", measure_network_accuracy(nn, images, 10000));
}

44872
networks/89.txt Normal file

File diff suppressed because it is too large Load diff

63384
networks/90.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,45 +0,0 @@
4
2
3
2
1
-0.2195067977
-0.1657067977
2
4
0.0297932023
0.0289932023
-0.2106067977
-0.0132067977
-0.1003067977
-0.0923067977
-0.1315067977
0.1174932023
2
1
-0.0374067977
0.1903932023
2
2
-0.1219067977
-0.1745067977
0.0758932023
0.0761932023
2
1
-0.0955067977
0.0071932023
2
2
-0.1881067977
-0.1272067977
-0.1149067977
-0.1048067977
3
2
0.1665932023
-0.2083067977
-0.1944067977
0.1201932023
0.1768932023
-0.1408067977

View file

@ -5,7 +5,6 @@
double sigmoid(double input);
Matrix* predict(Neural_Network* network, Matrix* image_data);
double square(double input);
Matrix* sigmoid_derivative(Matrix* matrix);
Matrix *calculate_weights_delta(Matrix *previous_layer_output, Matrix *delta_matrix, double learning_rate);
void apply_weights(Neural_Network* network, Matrix* delta_weights_matrix, int index);
@ -72,7 +71,7 @@ void save_network(Neural_Network* network) {
matrix_save(network->weights[i], file_name);
}
printf("Network Saved!");
printf("Network Saved!\n");
}
Neural_Network* load_network(char* file) {
@ -121,9 +120,6 @@ double measure_network_accuracy(Neural_Network* network, Image** images, int amo
for (int i = 0; i < amount; i++) {
Matrix* prediction = predict_image(network, images[i]);
matrix_print(prediction);
printf("Label: %c\n", images[i]->label);
int guess = matrix_argmax(prediction);
int answer = (unsigned char) images[i]->label;
@ -362,7 +358,3 @@ Matrix* sigmoid_derivative(Matrix* matrix) {
double sigmoid(double input) {
return 1.0 / (1 + exp(-1 * input));
}
double square(double input) {
return input * input;
}