0
我想了解一個Adaline神經元如何工作。Adaline神經元訓練
我用VB.NET編寫了一個示例代碼,我想訓練一個神經元的AND函數或OR函數。
這裏是我的代碼:
Dim Valid As Boolean
Dim c As Integer = 0
Do
Valid = True
c += 1
For i As Integer = 0 To ListBox1.Items.Count - 1
Dim s() As String = Microsoft.VisualBasic.Split(ListBox1.Items(i), " ")
Dim y As Single = (W(1) * CInt(s(0)) + W(2) * CInt(s(1)))' + W(3) * 1)
W(1) += Alpha * CSng(CInt(s(2)) - y) * CSng(CInt(s(0)))
W(2) += Alpha * CSng(CInt(s(2)) - y) * CSng(CInt(s(1)))
'W(3) += Alpha * CSng(CInt(s(2)) - y) * 1.0
Next
For i As Integer = 0 To ListBox1.Items.Count - 1
Dim s() As String = Microsoft.VisualBasic.Split(ListBox1.Items(i), " ")
Dim y As Single = (W(1) * CInt(s(0)) + W(2) * CInt(s(1)))' + W(3) * 1)
If CInt(s(2)) = 1 Then
If y < 1 Then
Valid = False
End If
Else
If y >= 1 Then
Valid = False
End If
End If
Next
Loop Until ((Valid) Or (c > 100000))
If c > 10000 Then
MsgBox("I Can't Learn!", MsgBoxStyle.Exclamation)
End If
我試着用偏見和不帶偏見。 (如果從評論部分刪除註釋標記,偏置將被添加到神經元)
,我與這些訓練集審判和& OR:
-1 -1 -1
-1 1 -1
1 -1 -1
1 1 1
0 0 0
0 1 0
1 0 0
1 1 1
0 0 0
0 1 1
1 0 1
1 1 1
-1 -1 -1
-1 1 1
1 -1 1
1 1 1
但神經元無法與訓練有素任何這些訓練集...
我該如何解決我的問題?