Написал такую нейросеть да говнокод но написал ее первый раз.Что не так?Она работает некорректно всегда значение становится меньше.
import random
trainingData = [[1,0,0],[0,1,0],[0,0,1]]
trainingWeights = [[1,2,3],[4,5,6],[7,8,9]]
results = [[],[],[]]
rightResults = [1,0,0]
globalresults = [0,0,0]
kupia = 0
chas = 0
for globalrange in range(1000):
for i in range(len(trainingData)):
for j in range(len(trainingData[i])):
for q in range(len(trainingData[i])):
results[j].append(trainingData[i][q]*trainingWeights[j][q])
for ia in range(len(results)):
for ja in range(len(results[ia])):
globalresults[ia]+=results[ia][ja]
for iaa in range(len(rightResults)):
globalresults[iaa] = globalresults[iaa]-rightResults[i]
chas = rightResults[0]
for jaa in range(len(rightResults)):
if chas < rightResults[jaa]:
cahs = rightResults[jaa]
kupia = jaa
trainingWeights[kupia],trainingWeights[0] = trainingWeights[0],trainingWeights[kupia]
for iaaa in range(len(trainingWeights)):
for jaaa in range(len(trainingWeights)):
kupia = random.randint(1,2)
if kupia == 1:
trainingWeights[iaaa][jaaa] = trainingWeights[0][jaaa]+random.random()
if kupia == 2:
trainingWeights[iaaa][jaaa] = trainingWeights[0][jaaa]-random.random()
globalresults = [0,0,0]
results = [[],[],[]]
cahs = 0
kupia = 0
#Тут проверка
trainingData = [[1,1,1]]
trainingWeights.pop(2)
trainingWeights.pop(1)
results = [[]]
globalresults = [0,0,0]
for i in range(len(trainingData)):
for j in range(len(trainingData[i])):
results[i].append(trainingData[i][j]*trainingWeights[i][j])
for i in range(len(trainingData)):
for j in range(len(trainingData[i])):
globalresults[i] += results[i][j]
print(globalresults)