] inputTraining = inputData targetTraining = targetData # nn = NNet(sizes=[5, 3], bias=True) nn = NNet(sizes=[6, 12, 2], bias=True) # nn = NNet([[[-0.829638, 0.164111, 0.398885], # [-0.603684, -0.603331, -0.819179], # [-0.080592, -0.386044, -0.931615], # [0.762514, -0.142887, -0.737862], # [0.175430, 0.790112, -0.267367], # [-0.732674, -0.825474, 0.232357]]], bias=True) # ]]) nn.setActivations(['relu', 'linear']) nn.setVerbose([]) nn.checkup(inputData, targetData) verbosePrint.vIteration = -1 verbosePrint.stage = '' cycles = 1000 report = cycles / 10 for iteration in range(cycles + 1): vprint(iteration, '~~~~~~~~~~~ Iteration %d ~~~~~~~~~~~' % iteration) combinedError = 0 for row_index in range(len(targetTraining)): datain = inputTraining[row_index:row_index + 1] goal_prediction = targetTraining[row_index:row_index + 1]
import numpy as np from nnet import NNet nn = NNet([[[0.1], [0.2], [-0.1]]]) nn.setAlpha(0.01) nn.setVerbose(True) datain = [[8.5, 0.65, 1.2]] goal = [[1]] for i in range(4): output = nn.fire(datain) print('Goal: ' + str(goal)) print(nn) nn.learn(datain, goal)