Book Image

Scala for Machine Learning

By : Patrick R. Nicolas
Book Image

Scala for Machine Learning

By: Patrick R. Nicolas

Overview of this book

Table of Contents (20 chapters)
Scala for Machine Learning
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Genetic algorithm components


Genetic algorithms have the following three components:

  • Genetic encoding (and decoding): This is the conversion of a solution candidate and its components into the binary format (an array of bits or a string of 0 and 1 characters)

  • Genetic operations: This is the application of a set of operators to extract the best (most genetically fit) candidates (chromosomes)

  • Genetic fitness functions: This is the evaluation of the fittest candidate using an objective function

Encodings and the fitness function are problem dependent. Genetic operators are not.

Encoding

Let's consider the optimization problem in machine learning that consists of maximizing the log likelihood or minimizing the loss function. The goal is to compute the parameters or weights, w={wi}, that minimize or maximize a function f(w). In the case of a nonlinear model, variables may depend on other variables, which make the optimization problem particularly challenging.

Value encoding

The genetic algorithm manipulates...