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."""
    violations = set()
    for point in svm.training_points:
        if point not in svm.support_vectors:
            if point.alpha != 0:
                violations.add(point)
        else:
            if point.alpha <= 0:
                violations.add(point)
    return violations