Compare commits
No commits in common. "86e4c8662e5a9fef2fc9f2be6d674ce0c42bb4c4" and "e09dbab2903a3618b38d11e14b4060090e100894" have entirely different histories.
86e4c8662e
...
e09dbab290
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"cells": [
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "1b99095f",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"language_info": {
|
|
||||||
"name": "python"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 5
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
#%%
|
|
||||||
# AG1a
|
|
||||||
import numpy as np
|
|
||||||
import nnwplot
|
|
||||||
|
|
||||||
def neuron(X):
|
|
||||||
N = X.shape[...]
|
|
||||||
net = np.zeros(N)
|
|
||||||
W = [....]
|
|
||||||
b = # Bias ... ergibt sich aus Aktivierungsschwelle
|
|
||||||
for n in range(0,N):
|
|
||||||
for j in range ...:
|
|
||||||
net[..]+=
|
|
||||||
b verwenden ...
|
|
||||||
return net ... # threshold ....
|
|
||||||
|
|
||||||
#%%
|
|
||||||
iris = np.loadtxt("iris.csv",delimiter=',')
|
|
||||||
|
|
||||||
X=iris[...]
|
|
||||||
T=iris[...]
|
|
||||||
|
|
||||||
print(X)
|
|
||||||
print(T)
|
|
||||||
|
|
||||||
#%%
|
|
||||||
# AG1b
|
|
||||||
nnwplot.plotTwoFeatures(X[...], T, neuron)
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# %%
|
|
||||||
import numpy as np
|
|
||||||
import nnwplot
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
# %% ErrorRate
|
|
||||||
def ErrorRate(Y,T):
|
|
||||||
if Y.ndim==1 or Y.shape[0]==1:
|
|
||||||
errors=Y!=T
|
|
||||||
return errors.sum()/Y.size
|
|
||||||
else: # für mehrere Ausgaben in one-hot Kodierung:
|
|
||||||
errors=Y.argmax(0)!=T.argmax(0)
|
|
||||||
return errors.sum()/Y.shape[1]
|
|
||||||
|
|
||||||
# %%
|
|
||||||
class SLN:
|
|
||||||
def __init__(...): # Konstruktor
|
|
||||||
np.random.seed(42)
|
|
||||||
self._b=np.zeros((AAA,1))
|
|
||||||
self._W=np.random.randn(BBB,CCC)/np.sqrt(DDD)
|
|
||||||
|
|
||||||
# def DeltaTrain(self, X, T, eta, maxIter, maxErrorRate):
|
|
||||||
# N=X.shape[1] # Anzahl Trainingsdaten
|
|
||||||
# plt.ion() # interactive mode on
|
|
||||||
# for it in range(maxIter):
|
|
||||||
# Y = ... # nur ein Aufruf
|
|
||||||
# err = ErrorRate(..., ...)
|
|
||||||
# if (it%20) == 0:
|
|
||||||
# print('#{} err:{}\n{}\n{}'.format(it,err,self._W,self._b))
|
|
||||||
# nnwplot.plotTwoFeatures(...)
|
|
||||||
# plt.pause(0.05) # warte auf GUI event loop (je nach python Version notwendig oder nicht)
|
|
||||||
# if err <= maxErrorRate:
|
|
||||||
# break
|
|
||||||
# # update _W
|
|
||||||
# ...
|
|
||||||
# # update _b
|
|
||||||
# ...
|
|
||||||
# print('#{} err:{}\n{}\n{}'.format(it,err,self._W,self._b))
|
|
||||||
# nnwplot.plotTwoFeatures(...)
|
|
||||||
# plt.pause(0.05) # warte auf GUI event loop (je nach python Version notwendig oder nicht)
|
|
||||||
#
|
|
||||||
# input("Press Enter to continue...") # wenn gewünscht ...
|
|
||||||
Loading…
Reference in New Issue