def test_step_type_setting(self): """...Test that SVRG step_type parameter behaves correctly """ svrg = SVRG() coeffs0 = weights_sparse_gauss(20, nnz=5, dtype=self.dtype) interc0 = None X, y = SimuLogReg(coeffs0, interc0, n_samples=3000, verbose=False, seed=123, dtype=self.dtype).simulate() model = ModelLogReg().fit(X, y) svrg.set_model(model) self.assertEqual(svrg.step_type, 'fixed') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_Fixed) svrg = SVRG(step_type='bb') svrg.set_model(model) self.assertEqual(svrg.step_type, 'bb') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_BarzilaiBorwein) svrg.step_type = 'fixed' self.assertEqual(svrg.step_type, 'fixed') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_Fixed) svrg.step_type = 'bb' self.assertEqual(svrg.step_type, 'bb') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_BarzilaiBorwein)
def test_step_type_setting(self): """...Test that SVRG step_type parameter behaves correctly """ svrg = SVRG() self.assertEqual(svrg.step_type, 'fixed') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_Fixed) svrg = SVRG(step_type='bb') self.assertEqual(svrg.step_type, 'bb') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_BarzilaiBorwein) svrg.step_type = 'fixed' self.assertEqual(svrg.step_type, 'fixed') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_Fixed) svrg.step_type = 'bb' self.assertEqual(svrg.step_type, 'bb') self.assertEqual(svrg._solver.get_step_type(), SVRG_StepType_BarzilaiBorwein)