From dcddbd017fde2cc83837832cde95663941712925 Mon Sep 17 00:00:00 2001 From: blusson Date: Thu, 17 Feb 2022 16:14:21 +0100 Subject: [PATCH] debut fleures --- tests/flowerGardenData | Bin 0 -> 8529 bytes tests/flowerGardenLearningVisualization.py | 17 +++++++++++ tests/generateSobekFlowerGarden.py | 34 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100755 tests/flowerGardenData create mode 100755 tests/flowerGardenLearningVisualization.py create mode 100755 tests/generateSobekFlowerGarden.py diff --git a/tests/flowerGardenData b/tests/flowerGardenData new file mode 100755 index 0000000000000000000000000000000000000000..ac5a67be7cefcc7ff511760c10604debbc406c2d GIT binary patch literal 8529 zcmeHLO-NK>6n#^QB`peUTeP!{n>H+j{SvcOVJBdlxR=fDcj8Gxy!^oO6HPyIb_|;u$Bn zuDRvjSLS4EdrPvTqOmO%uV`t%nZ8kiM%Inq)ettD}^w6oU&8tHr z=4=4p643q0%F=A#j53pR!L?~{j{za}ow9*T`Oa~3Ip691wl1I<6P$b(&|vUmc*`6Ez$v%kg zvm~Iw;Gj|+_7i9-^;oI{O|z;@=9J2l6Wl}M8@^r(eIn%zEoZ`h@=eGaXvcwHrUW$n zv25VMNde7yc{&(ClJe-t`7rjd5S#Oz6=$yo9U(S58)|<JdH7{f;Dqy%&b4O(o)^PzFKv(X2{%1^Z0?xYIX?+`GZSd~ zK|rHJyi)Gp^dR%M=S_9ctE7#CGgwzU+)wZXvnHI9JmVfu1vF6W;hdM|CH#?9&SLf` zWF$=zoN_7bgVHv`uBr10GI7J*Uh10Aa#p#`P)qJWcAo$}Y3M~e8Xb8-Il0N8?wJIc z3@bN0&ICLqNm}A`>&j;m?ha6CP;e|=1(l@dOZIPFXJduwIx^=DcYM2+^ap#b2JJZX zq8&}enUNh$o}tn+fp0z+bE4Q|gJ(X$ObD^rPvAxLs<`)(>HoJmG4Ium_crGUSlsKK z&u-MuJ?_36rHgfdBKJ{cHL7_<)j2x8bST{!_cNC6jyjYsFC9vE$HGQMm5He4RoH4D sWY5W0*i1yVI-;7FPVK_ZzOc`@pWN?fEFG(bjfyH?QOyf#$Kw@$0X4qum;e9( literal 0 HcmV?d00001 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