Machine learning (ML) enables a system to learn from experience and observation rather than relying entirely on explicit programming. Learning can be described in terms of a task, a performance measure, and experience that improves performance on that task. ML is a subfield of artificial intelligence. section 11.2 section 9.7
A useful starting intuition is curve fitting: choose a model, a scoring criterion, and a search strategy to find a mapping between inputs and outputs. For example, a vehicle’s camera image can be an input to a model that recognizes cars, pedestrians, lanes, and traffic lights. Neural networks can approximate complex relationships that would be difficult to write by hand. section 9.7
Machine learning approaches include:
- Supervised and unsupervised learning, which can be applied to optimization problems; self-organizing maps are one example of an unsupervised neural network. section 11.0 section 11.10
- Reinforcement learning, which can also be used for search and optimization. section 2.4
- Deep learning, which uses deep neural networks to detect features in data; graph machine learning focuses on learning from graph-structured data. section 11.10
For combinatorial optimization, ML can play three different roles:
- Produce a solution directly from a problem instance, as with a pointer network trained for a traveling salesperson problem. section 11.5
- Configure an optimization algorithm, for example by supplying a cooling schedule for simulated annealing or coefficients for particle swarm optimization. section 11.5
- Guide an optimization algorithm repeatedly: the model receives the algorithm’s current state and helps it make decisions during the search. section 11.5
Training a neural network with particle swarm optimization
A penguin classification example uses bill length, bill depth, flipper length, and body mass as inputs to a neural network. Particle swarm optimization searches for network weights and biases; a forward pass calculates class probabilities and a loss to score candidate parameters. The predicted class is the one with the highest output score. section 9.7
def forward_prop(params):
logits = logits_function(params) #1
exp_scores = np.exp(logits) #2
probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True) #2
correct_logprobs = -np.log(probs[range(num_samples), y]) #3
loss = np.sum(correct_logprobs) / num_samples #4
return loss #4
Inspect the forward pass that converts network outputs to probabilities and computes the loss used to score candidate parameters. section 9.7
Learning and prediction can involve uncertainty. Many statistical ML algorithms use randomness during training, and predictions may be less predictable when inputs depend on human behavior than when they follow physical laws. Consequently, ML-based optimization methods can be considered stochastic. section 2.2










































