# Naive Greedy¶

The naive greedy algorithm for optimization.

The naive greedy algorithm is the simplest greedy approach for optimizing submodular functions. The approach simply iterates through each example in the ground set that has not already been selected and calculates the gain in function value that would result from adding that example to the selected set. This process is embarassingly parallel and so is extremely amenable both to parallel processing and distributed computing. Further, because it is conceptually simple, it is also simple to implement.

The naive greedy algorithm can be specified for any function by passing in optimizer=’naive’ to the relevant selector object. Here is an example of specifying the naive greedy algorithm for optimizing a feature-based function.

param self.function:
A submodular function that implements the _calculate_gains and _select_next methods. This is the function that will be optimized.
type self.function:
base.BaseSelection
param self.verbose:
Whether to display a progress bar during the optimization process.
type self.verbose:
bool
self.function

A submodular function that implements the _calculate_gains and _select_next methods. This is the function that will be optimized.

Type: base.BaseSelection
self.verbose

Whether to display a progress bar during the optimization process.

Type: bool
self.gains_

The gain that each example would give the last time that it was evaluated.

Type: numpy.ndarray or None