From d1c47221a7fd93d6e508a89c8d6d71a65566fb45 Mon Sep 17 00:00:00 2001
From: Michael Mutote <130656746+mr1Michael@users.noreply.github.com>
Date: Wed, 22 Nov 2023 12:42:08 +0100
Subject: [PATCH] 22202956 - touch up on heuristics, N-QUEENS

---
 Reinforcement_Learning/Perceptrons.py        | 3 +--
 Reinforcement_Learning/PerceptronsSGD.py     | 2 +-
 Reinforcement_Learning/Solution_Testing_1.py | 5 +++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Reinforcement_Learning/Perceptrons.py b/Reinforcement_Learning/Perceptrons.py
index 66c47b5..c946835 100644
--- a/Reinforcement_Learning/Perceptrons.py
+++ b/Reinforcement_Learning/Perceptrons.py
@@ -26,7 +26,7 @@ class Perceptron:
         self.activation = activation
         self.weights = rng.random(input_count + 1)
 
-    def train(self, ETA):
+    def train_thres(self, ETA):
         teach_data = Training_data.make_testset(TEACHDATA)
         for i in range(TEACHDATA):
             old_weights = np.copy(self.weights)
@@ -38,7 +38,6 @@ class Perceptron:
                     delta = ETA * \
                         (T - self.activation(ix.dot(self.weights))) * ix
                     self.weights = self.weights + delta
-                # print(self.weights[0], self.weights[1], self.weights[2], self.weights[3], self.weights[4], self.weights[5], self.weights[6])
             if np.linalg.norm(old_weights - self.weights) == 0.00:
                 return self.weights
         return self.weights
diff --git a/Reinforcement_Learning/PerceptronsSGD.py b/Reinforcement_Learning/PerceptronsSGD.py
index 805f222..71d1e81 100644
--- a/Reinforcement_Learning/PerceptronsSGD.py
+++ b/Reinforcement_Learning/PerceptronsSGD.py
@@ -34,7 +34,7 @@ class PerceptronSGD:
                     RI = self.activation(z)
                     error = T - RI
                     delta = ETA * error * self.activation_derivative(z) * ix
-                    self.weights += delta
+                self.weights += delta
         return self.weights
 
     def test(self):
diff --git a/Reinforcement_Learning/Solution_Testing_1.py b/Reinforcement_Learning/Solution_Testing_1.py
index 334b49e..a308778 100644
--- a/Reinforcement_Learning/Solution_Testing_1.py
+++ b/Reinforcement_Learning/Solution_Testing_1.py
@@ -1,4 +1,5 @@
 import Perceptrons
+import PerceptronsSGD
 
 
 def test_function(ETA):
@@ -6,14 +7,14 @@ def test_function(ETA):
 
     results = []
     p = Perceptrons.Perceptron(input_count)
-    p.train(ETA)
+    p.train_thres(ETA)
     output = p.test()
     results.append((ETA, output))
     return results
 
 
 for ETA in ([0.05, 0.1, 0.2, 0.4, 0.75, 1, 2, 5]):  # the list of values for ETA
-    for i in range(5):
+    for i in range(1):
         res = test_function(ETA)
         print(res)  # print the results list
     print("\n\n")
-- 
GitLab