liveBook · Manning

Inertia component

As explained in Grokking AI Algorithms, Second Edition

The inertia component is the particle-swarm velocity term that preserves a particle's previous movement momentum.

The inertia component preserves a particle’s previous movement momentum during particle-swarm optimization. It combines the particle’s current velocity with an inertia value between 0 and 1. section 7.8

Adjusting inertia changes how a particle searches:

  • High inertia, near 1.0, maintains momentum and favors exploration of new regions. section 7.8
  • Low inertia, near 0, slows movement and favors exploitation around promising solutions. section 7.8

A momentum-based intuition

A heavy speeding freight truck represents high inertia: it keeps moving and turns slowly. A housefly represents low inertia: it slows quickly and changes direction easily. section 7.8

def calculate_inertia(inertia, current_velocity): #A
    return current_velocity[0] * inertia, current_velocity[1]
        ➥* inertia #B

def calculate_acceleration(constant, random_factor): #C
    return constant * random_factor #D

The implementation multiplies each current velocity component by the inertia value before combining it with cognitive and social components. section 7.8

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Defines the parameter and traces its velocity contribution, but defers the complete update to cognitive and social terms.
Examples
Uses freight-truck and housefly analogies plus a Python function multiplying current velocity by inertia.
What it assumes
Assumes particle-swarm particles and velocity updates while defining inertia and its search behavior directly.
What you can do after
Build it from scratch by calculating an inertia contribution from a particle’s current velocity.
How it connects
Connects inertia with particle swarm optimization, velocity, exploration, exploitation, cognitive component, and social component.

Also explained in

Compare how 2 books explain inertia component →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.