IRIS (Süsen Çiçeği) Veritabanı Kullanılarak Yapay Sinir Ağı Eğitimi
Bu yazıda süsen çiçieği (Iris) türlerinden (Setosa, Versicolor, Verginica) oluşturulan veri tabanı kullanılarak yapay sinir ağı eğitimi gerçekleştirilmiştir. Eğitim esnasında her bir türden 30 adet örnek kullanılmış ve eğitimde kullanılan örnekler ile birlikte toplam 50’şer örnekler ile test edilmiştir. Eğitim sonucunda elde edilen hata değeri aşağıda gösterilmiştir. Eğitim geriye yayılım algoritması ile gerçeklenmiştir.
Setosa, Versicolor, Verginica türlerine ait veriler için tıklayınız….
Eğitime ait MATLAB kodları aşağıda verilmiştir.
- load IRIS_Setosa.mat;
- load IRIS_Versicolor.mat;
- load IRIS_Verginica.mat;
- g_In = 4;
- g_X = 30;
- X = [IRIS_Setosa(1 : g_In, 1)...
- IRIS_Versicolor(1 : g_In, 1)...
- IRIS_Verginica(1 : g_In, 1)];
- Y = [IRIS_Setosa(5, 1)...
- IRIS_Versicolor(5, 1)...
- IRIS_Verginica(5, 1)];
- for n_i = 2 : g_X
- X = [X IRIS_Setosa(1 : g_In, n_i)...
- IRIS_Versicolor(1 : g_In, n_i)...
- IRIS_Verginica(1 : g_In, n_i)];
- Y = [Y IRIS_Setosa(5, n_i)...
- IRIS_Versicolor(5, n_i)...
- IRIS_Verginica(5, n_i)];
- end
- %% Agırlıklar oluşturuldu
- g_Layer_Cell = 10;
- [w_1 b_1 w_2 b_2] = WEIGTH_CREATE(X, Y, g_Layer_Cell, n_X, n_Y);
- g_L = 0.1;
- g_ITER = 100000;
- for n_i = 1 : g_ITER
- for n_j = 1 : n_Samples
- [ol_out hl_out] = MLP(X(:, n_j), w_1, b_1, w_2, b_2);
- [w_1 b_1 w_2 b_2] = PARAM_UPDATE(w_1, b_1, w_2, b_2,...
- d_w_1, d_b_1, d_w_2, d_b_2, g_L);
- end
- end
- X_TEST = [IRIS_Setosa(1 : g_In, : )...
- IRIS_Verginica(1 : g_In, : )...
- IRIS_Versicolor(1 : g_In, : )];
- Y_TEST = [IRIS_Setosa(5, : )...
- IRIS_Verginica(5, : )...
- IRIS_Versicolor(5, : )];
- E_n_t = 0;
- for n_j = 1 : n_Samples
- [ol_out(n_j) hl_out] = MLP(X_TEST(:, n_j), w_1, b_1, w_2, b_2);
- [error_t(n_j) E_n_t] = FITNESS_VALUE(E_n_t, Y_TEST(n_j), ol_out(n_j));
- end
- function [ol_out hl_out] = MLP(X, w_1, b_1, w_2, b_2)
- hl_sum = w_1 * X + b_1;
- hl_out = logsig(hl_sum);
- ol_out = hl_out' * w_2 +b_2;
- function [w_1 b_1 w_2 b_2] = PARAM_UPDATE(w_1, b_1, w_2, b_2,...
- d_w_1, d_b_1, d_w_2, d_b_2, g_L)
- w_1 = w_1 + g_L * d_w_1;
- w_2 = w_2 + g_L * d_w_2;
- b_1 = b_1 + g_L * d_b_1;
- b_2 = b_2 + g_L * d_b_2;
Bir cevap yazın