Be Skeptical of Greedy Algorithms
- Often for optimization problems (minimize/maximize)
- Hard to argue for correctness
- Use Proof by contradiction, or the exchange argument
- Works well for approximating optimal solutions
- When the correct algorithm is intractable (), then often the greedy solution that is is useful (=tractable)
- Gradient descent is a greedy optimization algorithm.
- Linear optimization algorithms are “analytical” and correct, but take lots of time.
- Gradient descent algorithms (all of ML) is greedy, but not the global optimum solution. They’re “good enough” and “tractable”
Proof of Correctness
- Feasibility: there is an algorithm that gives a solution that obeys the constraints of the problem
- Optimality: the algorithm’s solution is the best possible. Use either:
- Proof by Contradiction
- Let solution by greedy algorithm solution .
- Assume there is a more optimal solution
- Then derive a contradiction
- Exchange Argument
- Let solution by greedy algorithm solution
- Assume there is a optimal solution
- By exchanging individual elements which don’t reduce optimality, slowly show is at least as good as
- Staying Ahead
- At every stage of the greedy algorithm, show that it is at least as good as the optimal solution
- Proof by Contradiction
Examples