From 0883bbe1b6a4cbdc421325c9c7e5a0f28826922a Mon Sep 17 00:00:00 2001 From: "pieroot.02@gmail.com" Date: Fri, 17 May 2024 01:41:37 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EC=9A=94=EA=B5=AC=EC=82=AC=ED=95=AD=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pso/particle.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pso/particle.py b/pso/particle.py index 764c782..282cfaa 100644 --- a/pso/particle.py +++ b/pso/particle.py @@ -293,9 +293,8 @@ class Particle: * r_0 * (self.best_weights - self.weights) + global_rate - * Particle.g_best_score[1] - * r_1 - * (best_particle_weights - self.weights) + # * Particle.g_best_score[1] + * r_1 * (best_particle_weights - self.weights) ) if self.mutation != 0.0 and rng.random() < self.mutation: @@ -310,9 +309,9 @@ class Particle: """ 가중치 업데이트 """ - new_w = np.add(self.weights, self.velocities) + self.weights = np.add(self.weights, self.velocities) - self.model.set_weights(self._decode(new_w)) + self.model.set_weights(self.get_weights()) def step(self, x, y, local_rate, global_rate, w, renewal: str = "acc"): """