The discrepancy principle for a class of regularization methods