# `learner.greedy` – Greedy learner

This module provides a learner implementing the Greedy Learner algorithm. More information about greedy algorithms: http://en.wikipedia.org/wiki/Greedy_algorithm

## Configuration Parameters

`greedy.max_iterations`

  Maximum number of iterations to run. default=1000

`greedy.max_time`

  Maximum learner runtime in seconds. default=0

`greedy.max_unimproved_iterations`

  Maximum number of iterations without score improvement before a restart. default=restart_after_max_unimproved_iterations(500)

`greedy.seed`

  Starting network for a greedy search. default=’‘

## GreedyLearner Class

> class `pebl.learner.greedy.``GreedyLearner`(data_=None, prior_=None, **options)

>   Create a learner that uses a greedy learning algorithm.

>   The algorithm works as follows:

>   > 1. start with a random network
>   > 2. Make a small, local change and rescore network
>   > 3. If new network scores better, accept it, otherwise reject.
>   > 4. Steps 2-3 are repeated till the restarting_criteria is met, at which point we begin again with a new random network (step 1)

>   Any config param for ‘greedy’ can be passed in via options. Use just the option part of the parameter name.

>   For more information about greedy learning algorithms, consult:

>   > 1. http://en.wikipedia.org/wiki/Greedy_algorithm
>   > 2. D. Heckerman. A Tutorial on Learning with Bayesian Networks. Microsoft Technical Report MSR-TR-95-06, 1995. p.35.

>   `run`()

>     Run the learner.

>     Returns a LearnerResult instance. Also sets self.result to that instance.