moved regularization out of the class because you have to pass data in anyways