Example #1
0
def test_get_x():
    # if using list, get_x should get ints
    clf = OGDLR(ndims=100)
    clf.fit(X[:100], y[:100])
    xt = ['sunny', 'cold', X[0, 2]]
    result = clf._get_x(xt)
    assert all([isinstance(r, int) for r in result])

    # if using dict, get_x should give dictionary keys
    xt = ['sunny', 'cold', X[0, 2]]
    result = ogdlr_after._get_x(xt)
    expected = [
        'BIAS', 'weather__sunny', 'temperature__cold', 'noise__' + X[0, 2]
    ]
    assert result == expected
Example #2
0
def test_get_x():
    # if using list, get_x should get ints
    clf = OGDLR(ndims=100)
    clf.fit(X[:100], y[:100])
    xt = ['sunny', 'cold', X[0, 2]]
    result = clf._get_x(xt)
    assert all([isinstance(r, int) for r in result])

    # if using dict, get_x should give dictionary keys
    xt = ['sunny', 'cold', X[0, 2]]
    result = ogdlr_after._get_x(xt)
    expected = ['BIAS',
                'weather__sunny',
                'temperature__cold',
                'noise__' + X[0, 2]]
    assert result == expected