liveBook · Manning

Machine learning

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

Machine learning is the computational study of methods that improve predictions or decisions by learning patterns from data or experience.

Machine learning (ML) gives a system a way to improve through experience and observation rather than having every behavior explicitly programmed. The test is practical: for a chosen task and performance measure, does performance improve with experience? A useful first picture is curve fitting—learning a mapping from inputs to outputs—but a neural network can approximate relationships too complicated to write down by hand. section 11.2 section 9.7

From a camera image to a prediction

An object-recognition model can take an image from a vehicle’s front camera and predict objects such as pedestrians, cyclists, lanes, and traffic lights. Its predictions depend on what the model learned from data; they are not an explicitly written rule for every possible image. Data matters as much as model complexity: plentiful training examples can make a simple model more useful than an elaborate model trained on too little data. section 9.7 section 11.2

ML is a branch of artificial intelligence; deep learning uses deep neural networks, while graph machine learning learns from graph-structured data. Learning may be supervised, unsupervised, or reinforcement-based. Many statistical ML algorithms use randomness during training and make uncertain predictions, so an ML-guided optimizer should not be treated as a guaranteed, repeatable route to an optimum. section 11.10 section 2.2

There are three useful ways to bring ML into a combinatorial optimization problem:

  • Learn solutions end to end: give a model a problem instance and train it to produce a solution directly. A pointer network trained on points for a traveling-salesperson problem is one example. section 11.5
  • Learn how to configure an optimizer: select parameters such as a simulated-annealing cooling schedule or particle-swarm inertia and acceleration coefficients. section 11.5
  • Guide an optimizer as it runs: repeatedly consult a model using the algorithm’s current state to inform decisions. section 11.5

Training a classifier with particle swarm optimization

For penguin species classification, start with bill length, bill depth, flipper length, and body mass as inputs. A small neural network maps these measurements to class scores. Pack its weights and biases into a particle position, calculate a classification loss for each particle, and let particle swarm optimization search for better parameters. The worked configuration has 83 parameters; the reported results differ substantially among global-best, local-best, and binary PSO variants. Treat that contrast as a reason to experiment with optimizer choices, not as a universal ranking. section 9.7

def logits_function(p):
  
    W1 = p[0: n_inputs * n_hidden].reshape((n_inputs, n_hidden)) 
    b1 = p[n_inputs * n_hidden: (n_inputs + 1) * n_hidden].reshape((n_hidden,))  #1
    W2 = p[(n_inputs +1) * n_hidden: -n_classes].reshape((n_hidden, n_classes))  #2
    b2 = p[-n_classes:].reshape((n_classes,))                                    #3
  
    z1 = X.dot(W1) + b1                                                          #4
    a1 = np.tanh(z1)                                                             #4
    logits = a1.dot(W2) + b2                                                     #5
    return logits                                                                #5

Inspect the forward computation: a particle position is unpacked into layer weights and biases, then transformed into class scores. section 9.7

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines learning, distinguishes related approaches, and works through neural-network training with particle swarm optimization rather than proving learning theory.
Examples
Illustrates vehicle-camera object recognition, penguin species classification, and learned solutions for a traveling-salesperson problem.
What it assumes
Introduces machine-learning fundamentals as background for optimization applications and defers reinforcement learning to a later treatment.
What you can do after
Apply it via PySwarms to search neural-network parameters for penguin species classification.
How it connects
Connects artificial intelligence, deep learning, graph machine learning, reinforcement learning, and combinatorial optimization.

Also explained in

Compare how 42 books explain machine learning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.