예제 #1
0
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'
예제 #2
0
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'
예제 #3
0
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'
예제 #4
0
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'
예제 #5
0
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'
예제 #6
0
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'
예제 #7
0
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'
예제 #8
0
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'
예제 #9
0
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'
예제 #10
0
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"
예제 #11
0
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'
예제 #12
0
파일: test_rprop.py 프로젝트: osdf/climin
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'
예제 #13
0
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'
예제 #14
0
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'
예제 #15
0
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'