Skip to content

Ask149/ML_Algorithms

Repository files navigation

ML Algorithms

1. KNN
2. Linear Regression
3. Particle Swarm Optimization

1. K Nearest Neighbor

2. Linear Regression

3. Particle Swarm Optimization

Particle Swarm Optimization (PSO) is a metaheuristic based optimization algorithm for finding global optimal solution of a function. Here, the particles are considered as solutions to the function, which are randomly initialized. The algorithm iteratively converges to a globally optimal solution. Each particle in the population keeps track of its current position and the best solution it has encountered, called pos_bst.

Swarm

Each particle has an associated velocity used to traverse the search space. The swarm keeps track of the overall best solution, called swarm_pos_bst. In each iteration of the swarm updates the velocity of the particle toward a weighted sum of the pos_bst and swarm_pos_bst. The velocity of the particle is then added to the position of the particle and the particle is influenced to travel in a optimal direction with updated velocity.

At every iteration in PSO, the position x and velocity v of a particle is changed, based on following equations:

  • first equation

  • second equation

Executing the code

  • Clone this repository:
git clone https://github.com/ask149/ML_Algorithms
  • Run the code:
cd ML_Algorithms/<algorithm-name>
python3 <file-name>.py

References

About

Practice repo for ML Algotithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published