Skip to content

Unexpected stagnation with VonNeumann and Pyramid topologies #521

@earthtech23

Description

@earthtech23

Dear pyswarms contributors and maintainers,

I have noticed while extensively using pyswarms for neural network training when i am using as topology the VonNeumann or Pyramid architectures, my swarms are facing a strong stagnation that i cannot explain. The error i think it has to do with the argument r which is the range of VonNeumann topology (which i can't find it anywhere in the literature except some references that are not exactly describing what you mean by r). Some of the times, due to r selection in combination with the number of particles returns the following error

Traceback (most recent call last):
File "/home/earthtech/salinity/von_neumann_tuning_8.py", line 131, in
cost, pos = optimizer.optimize(f, iters=iters)
File "/home/earthtech/.local/lib/python3.10/site-packages/pyswarms/single/general_optimizer.py", line 252, in optimize
self.swarm.best_pos, self.swarm.best_cost = self.top.compute_gbest(
File "/home/earthtech/.local/lib/python3.10/site-packages/pyswarms/backend/topology/von_neumann.py", line 50, in compute_gbest
return super(VonNeumann, self).compute_gbest(swarm, p, k)
File "/home/earthtech/.local/lib/python3.10/site-packages/pyswarms/backend/topology/ring.py", line 78, in compute_gbest
idx_min = swarm.pbest_cost[self.neighbor_idx].argmin(axis=1)
IndexError: index 64 is out of bounds for axis 0 with size 64

My neural network is for regression analysis with 1 hidden layer of 6 neurons, 8 inputs at the input layer and 1 neuron in the output.

I have executed a lot of tests, hyperparameter tuning procedures and validation procedures with the same source code on a large number of feature subsets with LocalBest and GlobalBest PSO implementations and i faced no problem.

I am running on Ubuntu 20.04, python 3.10 and pyswarms 1.3.0

I have tried to contact some of you through email or personal accounts on social media.

Hope that we will find a solution.

Thanks for your contribution to the Evolutionary Intelligence community.

Best Regards,
Earthtech

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions