

def test_switch_to_ad3():
    if ((not get_installed(['qpbo'])) or (not get_installed(['ad3']))):
        return
    (X, Y) = generate_blocks_multinomial(n_samples=5, noise=1.5, seed=0)
    crf = GridCRF(n_states=3, inference_method='qpbo')
    ssvm = NSlackSSVM(Y, max_iter=10000)
    ssvm_with_switch = NSlackSSVM(crf, max_iter=10000, switch_to='ad3')
    ssvm.fit(X, Y)
    ssvm_with_switch.fit(X, Y)
    assert_equal(ssvm_with_switch.model.inference_method, 'ad3')
    assert_greater(ssvm_with_switch.objective_curve_[(- 1)], ssvm.objective_curve_[(- 1)])
    ssvm_with_switch = NSlackSSVM(crf, max_iter=10000, switch_to='ad3', tol=10)
    ssvm_with_switch.fit(X, Y)
    assert_equal(ssvm_with_switch.model.inference_method, 'ad3')

dataset/ETHPy150Open pystruct/pystruct/pystruct/tests/test_learners/test_n_slack_ssvm.py test_switch_to_ad3/VarMisuse@75/107 `crf`->`Y`