Commit 9f22b73f authored by Massih-Reza Amini's avatar Massih-Reza Amini
Browse files

message

parent b18221c8
......@@ -85,23 +85,21 @@
def perceptron(Train,MaxEpoch,eta):
W=[0.0 for i in range(len(Train[0]))]
epoch=0
err=1
d=len(Train[0])-1
E=[]
while (epoch<MaxEpoch and err!=0):
err=0
for x in Train:
dp=dotproduct(x,W)
if(x[d]*dp<=0):
err+=1
W[0]+=eta*x[d]
for i in range(d):
W[i+1]+=eta*x[d]*x[i]
E.append(err)
epoch+=1
return W,E
return W,err
```
%% Cell type:markdown id: tags:
2. Tournez l'algorithme sur la base Train avec 1000 époques et un pas de eta=0.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment