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
但神经元无法与训练有素任何这些训练集...
我该如何解决我的问题?