PageRenderTime 68ms CodeModel.GetById 17ms app.highlight 48ms RepoModel.GetById 1ms app.codeStats 0ms

/entrega2/ejercicio2/main.m

http://github.com/melisabok/RedesNeuronales
Objective C | 106 lines | 88 code | 18 blank | 0 comment | 11 complexity | 9cb34a2580148f636dc0bfe9095f245e MD5 | raw file
  1clear all
  2clc
  3
  4datos = csvread('drug5.csv');
  5delete('main_tansig_tansig.csv');
  6delete('main_tansig_logsig.csv');
  7delete('main_logsig_logsig.csv');
  8delete('main_logsig_tansig.csv');
  9delete('main_tansig_purelin.csv');
 10delete('main_logsig_purelin.csv');
 11delete('main_purelin_tansig.csv');
 12delete('main_logsig_logsig_1.csv');
 13delete('main_logsig_logsig_3.csv');
 14delete('main_logsig_logsig_5.csv');
 15delete('main_logsig_logsig_7.csv');
 16
 17% Tamanio de los datos
 18[CantFilas, CantCols] = size(datos);
 19% Escalo
 20M = escalar(datos, 1:CantCols-1);
 21%Parametros
 22cota_error = 0.000001;
 23alfa = 0.15;
 24MAX_ITERA = 3300;
 25
 26
 27for index = 1:5
 28    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'tansig', 'tansig', 4); 
 29    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 30    R
 31    dlmwrite('main_tansig_tansig.csv',R,'delimiter','\t','-append');
 32end
 33
 34for index = 1:5
 35    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'tansig', 'logsig', 4); 
 36    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 37    R
 38    dlmwrite('main_tansig_logsig.csv',R,'delimiter','\t','-append');
 39end
 40
 41for index = 1:5
 42    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'logsig', 4); 
 43    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 44    R
 45    dlmwrite('main_logsig_logsig.csv',R,'delimiter','\t','-append');
 46end
 47
 48for index = 1:5
 49    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'tansig', 4); 
 50    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 51    R
 52    dlmwrite('main_logsig_tansig.csv',R,'delimiter','\t','-append');
 53end
 54
 55for index = 1:5
 56    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'purelin', 4); 
 57    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 58    R
 59    dlmwrite('main_logsig_purelin.csv',R,'delimiter','\t','-append');
 60end
 61
 62for index = 1:5
 63    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'tansig', 'purelin', 4); 
 64    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 65    R
 66    dlmwrite('main_tansig_purelin.csv',R,'delimiter','\t','-append');
 67end
 68
 69for index = 1:5
 70    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'purelin', 'tansig', 4); 
 71    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 72    R
 73    dlmwrite('main_purelin_tansig.csv',R,'delimiter','\t','-append');
 74end
 75
 76for index = 1:5
 77    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'logsig', 1); 
 78    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 79    R
 80    dlmwrite('main_logsig_logsig_1.csv',R,'delimiter','\t','-append');
 81end
 82
 83for index = 1:5
 84    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'logsig', 3); 
 85    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 86    R
 87    dlmwrite('main_logsig_logsig_3.csv',R,'delimiter','\t','-append');
 88end
 89
 90for index = 1:5
 91    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'logsig', 5); 
 92    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
 93    R
 94    dlmwrite('main_logsig_logsig_5.csv',R,'delimiter','\t','-append');
 95end
 96
 97for index = 1:5
 98    [correctos_train correctos_test] = realizar_corrida(M, alfa, cota_error, MAX_ITERA, 'logsig', 'logsig', 7); 
 99    R = [alfa cota_error MAX_ITERA correctos_train correctos_test (correctos_train / 160) * 100 (correctos_test / 40) * 100];
100    R
101    dlmwrite('main_logsig_logsig_7.csv',R,'delimiter','\t','-append');
102end
103
104
105
106