Calculate mean squared generalization error and its gradient,
    automatically selecting the best function.

def _get_msge_with_gradient(data, delta, xvschema, skipstep, p):
    """Calculate mean squared generalization error and its gradient,
    automatically selecting the best function.
    """
    t, m, l = data.shape

    n = (l - p) * t
    underdetermined = n < m * p

    if underdetermined:
        return _msge_with_gradient_underdetermined(data, delta, xvschema,
                                                   skipstep, p)
    else:
        return _msge_with_gradient_overdetermined(data, delta, xvschema,
                                                  skipstep, p)