def test_row_column_predictive_probability(exname, rowid, colno): if exname == "t0" and colno > 1: pytest.skip("Not enough columns in t0.") if exname.startswith("t1_sub") and colno > 1: pytest.skip("Not enough columns in %s." % (exname,)) with analyzed_bayesdb_generator(examples[exname](), 1, 1) as (bdb, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, generator_id) bqlfn.bql_row_column_predictive_probability(bdb, generator_id, None, rowid, colno) sql = "select bql_row_column_predictive_probability(?, NULL, ?, ?)" bdb.sql_execute(sql, (generator_id, rowid, colno)).fetchall()
def test_row_column_predictive_probability(exname, rowid, colno): if exname == 't0' and colno > 1: pytest.skip('Not enough columns in t0.') if exname.startswith('t1_sub') and colno > 1: pytest.skip('Not enough columns in %s.' % (exname, )) with analyzed_bayesdb_generator(examples[exname](), 1, 1) \ as (bdb, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, generator_id) bqlfn.bql_row_column_predictive_probability(bdb, generator_id, None, rowid, colno) sql = 'select bql_row_column_predictive_probability(?, NULL, ?, ?)' bdb.sql_execute(sql, (generator_id, rowid, colno)).fetchall()
def test_row_column_predictive_probability(exname, rowid, colno): if exname == 't0' and colno > 1: pytest.skip('Not enough columns in t0.') if exname.startswith('t1_sub') and colno > 1: pytest.skip('Not enough columns in %s.' % (exname,)) with analyzed_bayesdb_population(examples[exname](), 1, 1) \ as (bdb, population_id, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, population_id) targets = json.dumps([colno]) constraints = json.dumps([]) bqlfn.bql_row_column_predictive_probability( bdb, population_id, None, None, rowid, targets, constraints) bdb.sql_execute(''' select bql_row_column_predictive_probability( ?, NULL, NULL, ?, \'%s\', \'%s\') ''' % (targets, constraints), (population_id, rowid) ).fetchall()
def test_row_column_predictive_probability(exname, rowid, colno): if exname == 't0' and colno > 1: pytest.skip('Not enough columns in t0.') if exname.startswith('t1_sub') and colno > 1: pytest.skip('Not enough columns in %s.' % (exname,)) with analyzed_bayesdb_population(examples[exname](), 1, 1) \ as (bdb, population_id, _generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, population_id) targets = json.dumps([colno]) constraints = json.dumps([]) bqlfn.bql_row_column_predictive_probability( bdb, population_id, None, None, rowid, targets, constraints) bdb.sql_execute(''' select bql_row_column_predictive_probability( ?, NULL, NULL, ?, \'%s\', \'%s\') ''' % (targets, constraints), (population_id, rowid) ).fetchall()