forked from 2211275/gnn
removed sigmoid from neuron plot
parent
e5b825b10d
commit
a96c60c72b
|
|
@ -15,16 +15,16 @@ grad = np.zeros(3)
|
||||||
def sigmoid(summe): # Transferfunktion
|
def sigmoid(summe): # Transferfunktion
|
||||||
return 1.0/(1.0+np.exp(-1.0*summe))
|
return 1.0/(1.0+np.exp(-1.0*summe))
|
||||||
|
|
||||||
def learn():
|
|
||||||
#TODO implement here
|
|
||||||
global train, weight, out, target, learnrate
|
|
||||||
# Neuronenausgabe für alle 4 Trainingsmuster berechnen
|
|
||||||
|
|
||||||
def perceptron(output):
|
def perceptron(output):
|
||||||
return max(np.sign(output), 0)
|
return max(np.sign(output), 0)
|
||||||
|
|
||||||
vperceptron = np.vectorize(perceptron)
|
vperceptron = np.vectorize(perceptron)
|
||||||
|
|
||||||
|
def learn():
|
||||||
|
#TODO implement here
|
||||||
|
global train, weight, out, target, learnrate
|
||||||
|
# Neuronenausgabe für alle 4 Trainingsmuster berechnen
|
||||||
|
|
||||||
out = vperceptron(np.matmul(train, weight))
|
out = vperceptron(np.matmul(train, weight))
|
||||||
|
|
||||||
for j in range(4):
|
for j in range(4):
|
||||||
|
|
@ -40,7 +40,7 @@ def outp(N=100): # Daten für die Ausgabefunktion generieren
|
||||||
x = np.linspace(0, 1, N)
|
x = np.linspace(0, 1, N)
|
||||||
y = np.linspace(0, 1, N)
|
y = np.linspace(0, 1, N)
|
||||||
xx, yy = np.meshgrid(x, y)
|
xx, yy = np.meshgrid(x, y)
|
||||||
oo = sigmoid(weight[0] + weight[1]*xx + weight[2]*yy)
|
oo = vperceptron(weight[0] + weight[1]*xx + weight[2]*yy)
|
||||||
return xx, yy, oo
|
return xx, yy, oo
|
||||||
|
|
||||||
def on_close(event): # Fenster schließen
|
def on_close(event): # Fenster schließen
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue