ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

VBA Ãþ¯«¸g¹Bºâ ¨D§U

¦^´_ 5# qwertyuio111
¥i§_¸Ô»¡, Ãþ¯«¸g¹Bºâ ¤½¦¡ªº³W«ßÅÞ¿è.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# qwertyuio111


­×§ï§Aªºµ{¦¡½X ¸Õ¸Õ¬Ý
  1. Option Explicit  '¦b¼Ò²Õ¼h¦¸¤¤±j­¢¨C­Ó¦b¼Ò²ÕùتºÅܼƳ£¥²¶·©ú½Tªº«Å§i
  2. Sub test()
  3.     Dim Sh As Worksheet, w(), i As Integer
  4.     Dim out As Single, ina1 As Single, inb1 As Single, ina2 As Single, outa2 As Single
  5.     Dim inc As Single, outc As Single, oute As Single, oute1 As Single, oute2 As Single
  6.     Dim inb2 As Single, outb2 As Single
  7.     Set Sh = Sheets("Sheet1")
  8.     out = Sh.Cells(1, 2)
  9.     ina1 = Sh.Cells(3, 2)
  10.     inb1 = Sh.Cells(5, 2)
  11.     w = Application.WorksheetFunction.Transpose(Sh.Range("b7").Resize(6))
  12.    
  13.     ina2 = (ina1 * w(3)) + (inb1 * w(4))
  14.     outa2 = 1 / (1 + Exp(-ina2))
  15.     inb2 = (ina1 * w(5)) + (inb1 * w(6))
  16.     outb2 = 1 / (1 + Exp(-inb2))
  17.     inc = (outa2 * w(1)) + (outb2 * w(2))
  18.     outc = 1 / (1 + Exp(-inc))
  19.     oute = (out - outc) * (1 - outc) * (outc)
  20.     w(1) = w(1) + (oute * outa2)
  21.     w(2) = w(2) + (oute * outb2)
  22.     oute1 = oute * w(1) * (1 - outa2) * outa2
  23.     oute2 = oute * w(2) * (1 - outb2) * outb2
  24.     w(3) = w(3) + (oute1 * ina1)
  25.     w(4) = w(4) + (oute1 * inb1)
  26.     w(5) = w(5) + (oute2 * ina1)
  27.     w(6) = w(6) + (oute2 * inb1)
  28. '***********************************************
  29.     For i = 2 To 300
  30.         ina2 = (ina1 * w(3)) + (inb1 * w(4))
  31.         outa2 = 1 / (1 + Exp(-ina2))
  32.         inb2 = (ina1 * w(5)) + (inb1 * w(6))
  33.         outb2 = 1 / (1 + Exp(-inb2))
  34.         inc = (outa2 * w(1)) + (outb2 * w(2))
  35.         outc = 1 / (1 + Exp(-inc))
  36.         oute = (out - outc) * (1 - outc) * (outc)
  37.         w(1) = w(1) + (oute * outa2)
  38.         w(2) = w(2) + (oute * outb2)
  39.         oute1 = oute * w(1) * (1 - outa2) * outa2
  40.         oute2 = oute * w(2) * (1 - outb2) * outb2
  41.         w(3) = w(3) + (oute1 * ina1)
  42.         w(4) = w(4) + (oute1 * inb1)
  43.         w(5) = w(5) + (oute2 * ina1)
  44.         w(6) = w(6) + (oute2 * inb1)
  45.     Next
  46.     ''''''''''''''''''''''''''''
  47.     With Sh
  48.         .Cells(14, 2) = ina2
  49.         .Cells(15, 2) = outa2
  50.         .Cells(17, 2) = inb2
  51.         .Cells(18, 2) = outb2
  52.         .Cells(20, 2) = inc
  53.         .Cells(21, 2) = outc
  54.         '''''''''''''''''''''''''''''
  55.         .Cells(23, 2) = oute
  56.         .Cells(25, 2) = w(1)
  57.         .Cells(26, 2) = w(2)
  58.         ''''''''''''''''''''''''
  59.         .Cells(29, 2) = oute1
  60.         .Cells(30, 2) = oute2
  61.         ''''''''''''''''''''
  62.         .Cells(32, 2) = w(3)
  63.         .Cells(33, 2) = w(4)
  64.         .Cells(34, 2) = w(5)
  65.         .Cells(35, 2) = w(6)
  66.     End With
  67. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD