Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Ucz_Click(object sender, EventArgs e)
- {
- int iloscEpok = 0;
- int aktual;
- while (iloscEpok < 25000)
- {
- aktual = -2;
- for(int i = 0; i < 10; i++)
- {
- //for (int x = 0; x < 10; x++) d[x] = 0.0;
- for (int j = 0; j < 10; j++)
- {
- for(int k = 0; k < 25; k++)
- {
- d[j] =d[j]+Math.Pow((daneUczace[i,k]-wagi[j,k]),2);
- }
- d[j] = Math.Sqrt(d[j]);
- }
- int min = 0;
- double mind = d[0];
- int mind2 = 0;
- for(int z = 1; z < 10; z++)
- {
- if (mind > d[z])
- {
- mind2 = min;
- mind = d[z];
- min = z;
- }
- }
- if (aktual != min)
- {
- aktual = min;
- best[i] = min;
- for (int s = 0; s < 25; s++)
- {
- wagi[best[i], s] = wagi[best[i], s] + alfa * (daneUczace[best[i], s] - wagi[best[i], s]);
- }
- }
- else
- {
- best[i] = mind2;
- for (int s = 0; s < 25; s++)
- {
- wagi[best[i], s] = wagi[best[i], s] + alfa * (daneUczace[best[i], s] - wagi[best[i], s]);
- }
- }
- }
- iloscEpok++;
- }
- textBox1.Text = "Wagi wyuczone";
- }
Advertisement
Add Comment
Please, Sign In to add comment