nntoolbox.ensembler.cv module

class nntoolbox.ensembler.cv.CVEnsembler(data: torch.utils.data.dataset.Dataset, path: str, n_model: int, model_fn: Callable[[], torch.nn.modules.module.Module], learn_fn: Callable[[torch.utils.data.dataset.Dataset, torch.utils.data.dataset.Dataset, torch.nn.modules.module.Module, str], None])[source]

Bases: object

Create an ensemble of identical models, each trained on a separate (k - 1) folds of the data and validated on the remaining fold.

References:

Anders Krogh and Jesper Vedelsby. “Neural Network Ensembles, Cross Validation, and Active Learning.” https://papers.nips.cc/paper/1001-neural-network-ensembles-cross-validation-and-active-learning.pdf

get_models() → List[torch.nn.modules.module.Module][source]
learn()[source]