def check_alpha_signs(svm):
    """Returns the set of training points that violate either condition:
        * all non-support-vector training points have alpha = 0
        * all support vectors have alpha > 0
    Assumes that the SVM has support vectors assigned, and that all training
    points have alpha values assigned."""
    points = svm.training_points
    support_vectors = svm.support_vectors
    bad_alphas = []
    for point in points:
        if point in support_vectors and point.alpha <= 0:
            bad_alphas.append(point)
        elif point not in support_vectors and point.alpha != 0:
            bad_alphas.append(point)
    return set(bad_alphas)