for i in range(len(data[0, :])): _max = np.max(data[:, i]) _min = np.min(data[:, i]) data[:, i] = (data[:, i] - _min) / (_max - _min) trainPortion = int(len(data) * 66 / 100) trainData = data[:trainPortion] testData = data[trainPortion:] test_dataset = testData[:, :-1].tolist() test_target = testData[:, -1:].tolist() dataset = trainData[:, :-1].tolist() target = trainData[:, -1:].tolist() myNet5 = net.Dense() myNet5.AddLayer(13, isInput=True) myNet5.AddLayer(5, activationFunction=af.Sigmoid) myNet5.AddLayer(1, activationFunction=af.Sigmoid) myNet20 = net.Dense() myNet20.AddLayer(13, isInput=True) myNet20.AddLayer(20, activationFunction=af.Sigmoid) myNet20.AddLayer(1, activationFunction=af.Sigmoid) start_time = time.time() myNet5.Train(dataset, target, iterationCount=20, learningRateStart=.6, learningRateEnd=.0,
import Network as net import ActivationFunction as af myNet = net.Dense() myNet.AddLayer(2, isInput=True) myNet.AddLayer(3, activationFunction=af.Sigmoid) myNet.AddLayer(1, activationFunction=af.Sigmoid) dataset = [[5, 1], [8, 2], [9, .5], [7, 1.2], [.5, 8], [1.2, 9.5], [.7, 7], [1.5, 6]] target = [[0], [0], [0], [0], [1], [1], [1], [1]] myNet.Train(dataset, target, 1000, .2) print(myNet.GetOutput([6.5, 1.5])) print(myNet.GetOutput([.1, 10]))