MIGA class documentation¶
-
class
miga.
MIGA
¶ Mutual Information Genetic Algorithm main class.
This class stores the current state of the genetic algorithm and dispatch its calculations to the selected platform.
-
death
¶ Genetic algorithm death rate.
This rate indicates the proportion of entities (based on population size) that will be killed between the generations. Worst fitness entities are killed first. Elite entities never get killed. Death rate must be a value in the range [0, 1).
-
elite
¶ Genetic algorithm elite ratio.
This ratio indicates the proportion of entities (based on population size) that will never be killed or mutated between generations. Elite ratio must be a value in the range [0, 1).
-
fitness
¶ Population fitness
Read-only copy of of the array containing each entity fitness value. This array is first initialized with zeros.
See also
-
genome
¶ Population genome.
Encoded genome for each entity. Each number indicates to which sequence in group B the current index is paired. Genomes are randomly initialized when
set_msa
is called or whenpop_size
is increased. When setting genome to another matrix, shape must be preserved.
-
lambda_
¶ Mutual information pseudocounter parameter.
Parameter used by the pseudocounter in the mutual information calculations.
-
minimize
¶ Optimization target.
True if the genetic algorithm must minimize the fitness, False otherwise.
-
mutation
¶ Genetic algorithm mutation rate.
This rate indicates the proportion of swaps (based on genome size) that will be applied to each entity between the generations. Mutations are not applied to elite entities. Mutation rate must be a non-zero value.
-
platform
¶ Platform which will be used by the genetic algorithm.
Platform where the genetic algorithm calculations will run. Possible values are ‘CPU’, ‘GPU’ and ‘SimpleGPU’. Platforms ‘GPU’ and ‘SimpleGPU’ will be available only if the package was compiled with CUDA support. Platform ‘SimpleGPU’ is a non-optimized reference platform to help on writing new platforms for GPU use.
See also
-
pop_size
¶ Population size.
Number of entities used by the genetic algorithm. There must be at least one entity.
-
q
¶ Number of symbols in the MSA.
Total number of possible symbols used to encode both MSAs. Must be a non-zero value.
-
run
()¶ Run the genetic algorithm.
Run the genetic algorithm for generations generations with the current state (e.g. population, MSA, platform). In each generation the following steps are repeated:
- Entities will be sorted based on their fitness (see
minimize
). - Worst fitness entities will be replaced by copies of the remaining entities (see
death
). - Non-elite entities genomes will be mutated (see
elite
andmutation
).
Parameters: generations (:type:`int`) – Number of generations to run the genetic algorithm. If it’s 0, population will be sorted based on the calculated fitness values. - Entities will be sorted based on their fitness (see
-
set_msa
()¶ Set MSA used to do MI calculations.
Set the MSA that represents the two groups used in the calculation and initialize the genomes of all population to a random state.
Parameters:
-
threads
¶ Number of threads to be used by multithreading platforms.
There must be at least 1 thread. This attribute is innefective when using any GPU platform.
-