diff --git a/tests/flowerGardenData b/tests/flowerGardenData new file mode 100755 index 0000000..ac5a67b Binary files /dev/null and b/tests/flowerGardenData differ diff --git a/tests/flowerGardenLearningVisualization.py b/tests/flowerGardenLearningVisualization.py new file mode 100755 index 0000000..1ebc9d1 --- /dev/null +++ b/tests/flowerGardenLearningVisualization.py @@ -0,0 +1,17 @@ +#!/bin/python3 +from sys import path +path.insert(1, "..") +from sobek.network import network +import pickle + +with open("flowerGardenData", "rb") as file: + data = pickle.load(file) + +trainPoints = data[0] +trainLabels = data[1] + +myNetwork = network(2, 16, 1) + +learningRate = 5.0 + +myNetwork.train(trainPoints, trainLabels, learningRate, batchSize=10, epochs=1000, visualize=True) diff --git a/tests/generateSobekFlowerGarden.py b/tests/generateSobekFlowerGarden.py new file mode 100755 index 0000000..dc9a57c --- /dev/null +++ b/tests/generateSobekFlowerGarden.py @@ -0,0 +1,34 @@ +#!/bin/python3 +import random +import numpy as np +import math +import pickle + +trainPoints = [] +trainLabels = [] + +random.seed(1216513) + +for i in range(100): + x = random.randint(-50, 50) + y = random.randint(-50, 50) + + distance = math.sqrt(x**2 + y**2) + + if (distance < 10 or 20 < distance < 30): + trainLabels.append(np.ones(1)) + else : + trainLabels.append(np.zeros(1)) + + x = (x+50)/100 + y = (y+50)/100 + + trainPoints.append(np.array([x, y])) + +print(trainPoints[1]) +print(trainLabels[1]) + +data = [trainPoints, trainLabels] + +with open("flowerGardenData", "wb") as file: + pickle.dump(data, file) \ No newline at end of file