debut fleures

This commit is contained in:
blusson 2022-02-17 16:14:21 +01:00
parent 58d2d70f2b
commit dcddbd017f
3 changed files with 51 additions and 0 deletions

BIN
tests/flowerGardenData Executable file

Binary file not shown.

View File

@ -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)

View File

@ -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)