scikit-learn/scikit-learn — pull request #3529 by perimosocordiae (2014-08-04 17:48:13+00:00)
Title: ENH: Add a default label to LabelPropagation algorithms (fixes #3218)

This PR addresses the issues raised in #3218. There are two changes that might affect users:

1. A new kwarg is added to `LabelPropagation`/`LabelSpreading` initializers, which lets the user set default labels for instances that aren't labeled by the `fit()` call. This defaults to `None`, which means that the presence of any unlabeled instances will trigger an exception. If not `None`, the `transduction_` array will be given default values for unlabeled instances.

2. The termination condition in `fit()` had an off-by-one error, where setting `max_iter=1` was iterating zero times. This has been fixed.

I've also supplied a test case that exercises this new behavior.