def restore_training(fn, netclass, trainclass, valclass, valdata, gpu=True):
    """Restore training from file.

    :param fn: filename to load
    :param netclass: :class:`.network.Network` class to use
    :param trainclass: :class:`TrainAlgorithm` class to use
    :param valclass: :class:`.validate.Validation` class to use
    :param valdata: list of :class:`.data.DataPoint` to validate with
    :param gpu: (optional) whether to use GPU or CPU
    :return: network object, training algorithm object, and validation object
    """
    n = netclass.from_file(fn, groupname='checkpoint', gpu=gpu)
    t = trainclass.from_file(fn)
    v = valclass.from_file(fn)
    v.d = valdata
    return n, t, v