def test_ncg_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = NonlinearConjugateGradient(obj.pars, obj.f, obj.fprime, args=args) for i, info in enumerate(opt): if i > 50: break assert obj.solved(), 'did not find solution'
def test_bfgs_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Bfgs(obj.pars, obj.f, obj.fprime, args=args) for i, info in enumerate(opt): if i > 50: break assert obj.solved(), 'did not find solution'
def test_nesterov_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Nesterov(obj.pars, obj.fprime, steprate=0.1, args=args) for i, info in enumerate(opt): if i > 750: break assert obj.solved(), 'did not find solution'
def test_xnes_lr(): obj = LogisticRegression(seed=10101) args = itertools.repeat(((obj.X, obj.Z), {})) opt = Xnes(obj.pars, obj.f, args=args) for i, info in enumerate(opt): if i > 100: break assert obj.solved(), 'did not find solution'
def test_smd_lr(): obj = LogisticRegression(seed=10101) args = itertools.repeat(((obj.X, obj.Z), {})) opt = Smd(obj.pars, obj.f, obj.fprime, obj.f_Hp, args=args, eta0=0.1) for i, info in enumerate(opt): if i > 150: break assert obj.solved(), 'did not find solution'
def test_asgd_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Asgd(obj.pars, obj.fprime, eta0=0.2, lmbd=1e-2, t0=0.1, args=args) for i, info in enumerate(opt): if i > 3000: break assert obj.solved(0.15), 'did not find solution'
def test_sbfgs_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Sbfgs(obj.pars, obj.f, obj.fprime, args=args) for i, info in enumerate(opt): if i > 50: break assert obj.solved(), 'did not find solution'
def test_xnes_lr(): obj = LogisticRegression(seed=10101) args = itertools.repeat(((obj.X, obj.Z), {})) opt = Xnes(obj.pars, obj.f, args=args) for i, info in enumerate(opt): if i > 100: break assert obj.solved(), "did not find solution"
def test_adadelta_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Adadelta(obj.pars, obj.fprime, 0.9, args=args) for i, info in enumerate(opt): print obj.f(opt.wrt, obj.X, obj.Z) if i > 3000: break assert obj.solved(0.15), 'did not find solution'
def test_rprop_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Rprop(obj.pars, obj.f, obj.fprime, step_shrink=0.1, step_grow=1.2, min_step=1e-6, max_step=0.1, args=args) for i, info in enumerate(opt): if i > 500: break assert obj.solved(), 'did not find solution'
def test_gd_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = GradientDescent( obj.pars, obj.fprime, step_rate=0.01, momentum=.9, args=args) for i, info in enumerate(opt): if i > 500: break assert obj.solved(), 'did not find solution'
def test_gd_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = GradientDescent(obj.pars, obj.fprime, step_rate=0.01, momentum=.9, args=args) for i, info in enumerate(opt): if i > 500: break assert obj.solved(), 'did not find solution'
def test_rprop_lr(): obj = LogisticRegression() args = itertools.repeat(((obj.X, obj.Z), {})) opt = Rprop(obj.pars, obj.fprime, step_shrink=0.1, step_grow=1.2, min_step=1e-6, max_step=0.1, args=args) for i, info in enumerate(opt): if i > 500: break assert obj.solved(), 'did not find solution'