From 6d77432628eef8d784d29ae4255909c4fd04dcf9 Mon Sep 17 00:00:00 2001 From: Michael Mutote <130656746+mr1Michael@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:35:47 +0100 Subject: [PATCH] 22202956 - optimised training supervised training --- Reinforcement_Learning/Perceptrons.py | 2 +- Reinforcement_Learning/Solution_Testing_1.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Reinforcement_Learning/Perceptrons.py b/Reinforcement_Learning/Perceptrons.py index 30a2974..a1ad48e 100644 --- a/Reinforcement_Learning/Perceptrons.py +++ b/Reinforcement_Learning/Perceptrons.py @@ -2,7 +2,7 @@ import numpy as np import Training_data rng = np.random.default_rng(123) -TEACHDATA = 100000 +TEACHDATA = 10000 TESTDATA = 1000 # ETA = 0.5 T_NUMBER = 1 # Number to be detected 0-6 diff --git a/Reinforcement_Learning/Solution_Testing_1.py b/Reinforcement_Learning/Solution_Testing_1.py index 1153878..0b07b7c 100644 --- a/Reinforcement_Learning/Solution_Testing_1.py +++ b/Reinforcement_Learning/Solution_Testing_1.py @@ -1,7 +1,6 @@ import numpy as np import Perceptrons -import PerceptronsSGD def test_function(ETA, p): @@ -18,13 +17,13 @@ for ETA in ([0.05, 0.1, 0.2, 0.4, 0.75, 1, 2, 5]): # the list of values for ETA x.train(ETA/200) y = Perceptrons.SGDPerceptron(20) y.train(ETA) - for i in range(10): + for i in range(1): res = test_function(ETA, w) print("Thres", res) # print the results list - for i in range(10): + for i in range(1): res = test_function(ETA/200, x) print("Lin", res) # print the results list - for i in range(10): + for i in range(1): res = test_function(ETA, y) print("sgd", res) # print the results list print("\n\n") -- GitLab