Sun’iy neyron tarmoqlari. Sodda neyron tarmoqlarini qurish. Neyron tarmoqlarining to‘gri va teskari tarqalish algoritmlari.
Pandas, numpy va matplotlib kutubxonalarini import qildim. Malumotlarni tahlil qilish uchun pandas kutubxonasini import qilib pd ko’rinishida yozdim. Grafiklarni chizish uchun matplotlib kutubxonasidan pyplot modulini import qilib plt ko’rinishida yozdim. Datasetni hosil qilish uchun numpy kutubxonasini import qildim va np ko’rinishida yozdim.
Dataset
dataset = np.array([
[5, 1180,50, 2,1, 0],
[6, 1490, 55,2,1, 0],
[41, 1370, 60,2,1,0],
[42, 2300,65, 2,1,0],
[43, 2000,70, 2,1,0],
[44, 1370,75, 2,1,0],
[24, 2300,140, 4,2,1],
[25, 2890,143, 4,2,1],
[26, 2500,145, 4,3,1],
[27, 2660,149, 4,3,1],
[28, 2700,152, 4,3,1],
[11, 1444,80, 2,1,0],
[12, 1100,85, 3,1,0],
[13, 1550,90, 3,1,0],
[14, 1490,95, 3,1,0],
[15, 1280,100, 3,1,0],
[16, 1290,105,3,2,0],
[17, 1880,110, 3,2,0],
[45, 1990, 115,3,2,0],
[46, 2050,120, 3,2,1],
[47, 2150,125, 3,2,1],
[21, 2220,130, 3,2,1],
[22, 2100,135, 3,2,1],
[34, 2380,137, 3,2,1],
[29, 2500,120, 4,3,1],
[30, 2900,156, 4,3,1],
[31, 1990,157, 4,3,1],
[32, 2600,159, 4,3,2],
[33, 2700,160, 4,3,2],
[19, 2890,150, 4,3,2],
[35, 2690,175, 5,3,2],
[36, 2400,180, 5,3,2],
[37, 1940,185, 5,3,2],
[38, 1870,189, 5,3,2],
[39, 2100,200, 6,3,2],
[40, 2330,195, 6,3,2],
[6, 2790,196, 6,3,2],
[7, 2600,200, 6,3,2],
[9, 2280, 210,7,3,2],
[10, 2790, 220,7,3,2]
])
X va Y o’zgaruvchilarning qiymatlarini quyidagicha tekshirildi
array([[ 5, 1180, 50, 2, 1],
[ 6, 1490, 55, 2, 1],
[ 41, 1370, 60, 2, 1],
[ 42, 2300, 65, 2, 1],
[ 43, 2000, 70, 2, 1],
[ 44, 1370, 75, 2, 1],
[ 24, 2300, 140, 4, 2],
[ 25, 2890, 143, 4, 2],
[ 26, 2500, 145, 4, 3],
[ 27, 2660, 149, 4, 3],
[ 28, 2700, 152, 4, 3],
[ 11, 1444, 80, 2, 1],
[ 12, 1100, 85, 3, 1],
[ 13, 1550, 90, 3, 1],
[ 14, 1490, 95, 3, 1],
[ 15, 1280, 100, 3, 1],
[ 16, 1290, 105, 3, 2],
[ 17, 1880, 110, 3, 2],
[ 45, 1990, 115, 3, 2],
[ 46, 2050, 120, 3, 2],
[ 47, 2150, 125, 3, 2],
[ 21, 2220, 130, 3, 2],
[ 22, 2100, 135, 3, 2],
[ 34, 2380, 137, 3, 2],
[ 29, 2500, 120, 4, 3],
[ 30, 2900, 156, 4, 3],
[ 31, 1990, 157, 4, 3],
[ 32, 2600, 159, 4, 3],
[ 33, 2700, 160, 4, 3],
[ 19, 2890, 150, 4, 3],
[ 35, 2690, 175, 5, 3],
[ 36, 2400, 180, 5, 3],
[ 37, 1940, 185, 5, 3],
[ 38, 1870, 189, 5, 3],
[ 39, 2100, 200, 6, 3],
[ 40, 2330, 195, 6, 3],
[ 6, 2790, 196, 6, 3],
[ 7, 2600, 200, 6, 3],
[ 9, 2280, 210, 7, 3],
[ 10, 2790, 220, 7, 3]])
Keras kutubxonasidan foydalangan holda masalaga mos neyron tarmoq arxitekturasini qurishni quyidagicha boshladim. To_categorial modulini import qildim va Y qiymatini o’zgartirib y ga o’zlashtirdim.
Neyron tarmoqni o’qitish paramertlarini(o’qish qadami-lr, o’qitishlar soni-epochs) ni tanladim va quyidagi kod orqali history ga o’zlashtirib ekranga chiqardim.
Dostları ilə paylaş: |