Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::NeuralNetwork::Gene::Schema::GeneticAlgorithmFinder::find_schemas (   self,
  fitness,
  num_schemas 
)

Find the given number of unique schemas using a genetic algorithm

Arguments:

o fitness - A callable object (ie. function) which will evaluate
the fitness of a motif.

o num_schemas - The number of unique schemas with good fitness
that we want to generate.

Definition at line 227 of file Schema.py.

00227                                                 :
        """Find the given number of unique schemas using a genetic algorithm

        Arguments:

        o fitness - A callable object (ie. function) which will evaluate
        the fitness of a motif.

        o num_schemas - The number of unique schemas with good fitness
        that we want to generate.
        """
        start_population = \
           Organism.function_population(self.motif_generator.random_motif,
                                        self.initial_population,
                                        fitness)
        finisher = SimpleFinisher(num_schemas, self.min_generations)

        # set up the evolver and do the evolution
        evolver = GenerationEvolver(start_population, self.selector)
        evolved_pop = evolver.evolve(finisher.is_finished)

        # convert the evolved population into a PatternRepository
        schema_info = {}
        for org in evolved_pop:
            # convert the Genome from a MutableSeq to a Seq so that
            # the schemas are just strings (and not array("c")s)
            seq_genome = org.genome.toseq()
            schema_info[seq_genome.data] = org.fitness

        return PatternRepository(schema_info)

# -- fitness classes

class DifferentialSchemaFitness:


Generated by  Doxygen 1.6.0   Back to index