示例#1
0
def test_twocolumn(exname, colno0, colno1):
    if exname == 't0':
        pytest.skip('Not enough columns in t0.')
    if exname.startswith('t1_sub') and (colno0 > 1 or colno1 > 1):
        pytest.skip('Not enough columns in %s.' % (exname,))
    with analyzed_bayesdb_generator(examples[exname](), 1, 1) \
            as (bdb, generator_id):
        bqlfn.bql_column_correlation(bdb, generator_id, colno0, colno1)
        bdb.sql_execute('select bql_column_correlation(?, ?, ?)',
            (generator_id, colno0, colno1)).fetchall()
        bqlfn.bql_column_dependence_probability(bdb, generator_id, None,
            colno0, colno1)
        bdb.sql_execute('select'
            ' bql_column_dependence_probability(?, NULL, ?, ?)',
            (generator_id, colno0, colno1)).fetchall()
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1)
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1, numsamples=None)
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1, numsamples=1)
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, NULL)',
            (generator_id, colno0, colno1)).fetchall()
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, 1)',
            (generator_id, colno0, colno1)).fetchall()
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, 100)',
            (generator_id, colno0, colno1)).fetchall()
示例#2
0
def test_twocolumn(exname, colno0, colno1):
    if exname == 't0':
        pytest.skip('Not enough columns in t0.')
    if exname.startswith('t1_sub') and (colno0 > 1 or colno1 > 1):
        pytest.skip('Not enough columns in %s.' % (exname,))
    with analyzed_bayesdb_generator(examples[exname](), 1, 1) \
            as (bdb, generator_id):
        bqlfn.bql_column_correlation(bdb, generator_id, colno0, colno1)
        bdb.sql_execute('select bql_column_correlation(?, ?, ?)',
            (generator_id, colno0, colno1)).fetchall()
        bqlfn.bql_column_dependence_probability(bdb, generator_id, None,
            colno0, colno1)
        bdb.sql_execute('select'
            ' bql_column_dependence_probability(?, NULL, ?, ?)',
            (generator_id, colno0, colno1)).fetchall()
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1)
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1, numsamples=None)
        bqlfn.bql_column_mutual_information(bdb, generator_id, None, colno0,
            colno1, numsamples=1)
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, NULL)',
            (generator_id, colno0, colno1)).fetchall()
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, 1)',
            (generator_id, colno0, colno1)).fetchall()
        bdb.sql_execute('select'
            ' bql_column_mutual_information(?, NULL, ?, ?, 100)',
            (generator_id, colno0, colno1)).fetchall()