From 25f19c346c3056f7d59637b4f1e0ba3044e988e8 Mon Sep 17 00:00:00 2001 From: Mohsinmahmood Date: Wed, 12 Jun 2024 03:46:42 +0500 Subject: [PATCH 1/2] Fix incorrect parameters in np.argmax() for Genetic Algorithm in tsp.py Issue #1256: Replace np.argmax with argmax_random_ties to correctly reference method and avoid TypeError. --- gui/tsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/tsp.py b/gui/tsp.py index 590fff354..bbe060499 100644 --- a/gui/tsp.py +++ b/gui/tsp.py @@ -260,7 +260,7 @@ def fitness_fn(state): while True: population = [mutate(recombine(*select(2, population, fitness_fn)), self.mutation_rate.get()) for _ in range(len(population))] - current_best = np.argmax(population, key=fitness_fn) + current_best = utils.argmax_random_ties(population, key=fitness_fn) if fitness_fn(current_best) > fitness_fn(all_time_best): all_time_best = current_best self.cost.set("Cost = " + str('%0.3f' % (-1 * problem.value(all_time_best)))) From fcc85b8b1f2628aba227b588e263436e761297e9 Mon Sep 17 00:00:00 2001 From: Mohsinmahmood Date: Wed, 12 Jun 2024 03:55:47 +0500 Subject: [PATCH 2/2] Fix ValueError in test_svc for test_learning.py and test_learning4e.py Issue #1272: Updated optimizer parameter from lr to learning_rate in deep_learning4e.py to resolve Rank(A) < p error. --- deep_learning4e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deep_learning4e.py b/deep_learning4e.py index 9f5b0a8f7..7250751d3 100644 --- a/deep_learning4e.py +++ b/deep_learning4e.py @@ -575,7 +575,7 @@ def AutoencoderLearner(inputs, encoding_size, epochs=200, verbose=False): model.add(Dense(input_size, activation='relu', kernel_initializer='random_uniform', bias_initializer='ones')) # update model with sgd - sgd = optimizers.SGD(lr=0.01) + sgd = optimizers.SGD(learning_rate=0.01) model.compile(loss='mean_squared_error', optimizer=sgd, metrics=['accuracy']) # train the model