<commit_before>import os
from itertools import izip
from nose.tools import assert_false, assert_equal
from distributions.fileutil import tempdir
from distributions.io.stream import open_compressed
from loom.schema_pb2 import CrossCat, PreQL
from loom.test.util import for_each_dataset
from loom.test.util import CLEANUP_ON_ERROR
import loom.predict

CONFIG = {}


def get_example_queries(model):
    cross_cat = CrossCat()
    with open_compressed(model) as f:
        cross_cat.ParseFromString(f.read())
    feature_count = sum(len(kind.featureids) for kind in cross_cat.kinds)

    all_observed = [True] * feature_count
    none_observed = [False] * feature_count
    observeds = []
    observeds.append(all_observed)
    for f in xrange(feature_count):
        observed = all_observed[:]
        observed[f] = False<commit_msg>Add more example queries to predict test<commit_after>import os
from itertools import izip
from nose.tools import assert_false, assert_equal
from distributions.dbg.random import sample_bernoulli
from distributions.fileutil import tempdir
from distributions.io.stream import open_compressed
from loom.schema_pb2 import CrossCat, PreQL
from loom.test.util import for_each_dataset
from loom.test.util import CLEANUP_ON_ERROR
import loom.predict

CONFIG = {}


def get_example_queries(model):
    cross_cat = CrossCat()
    with open_compressed(model) as f:
        cross_cat.ParseFromString(f.read())
    feature_count = sum(len(kind.featureids) for kind in cross_cat.kinds)

    all_observed = [True] * feature_count
    none_observed = [False] * feature_count
    observeds = []
    observeds.append(all_observed)
    for f in xrange(feature_count):
        observed = all_observed[:]
        observed[f] = False
        observeds.append(observed)
    for f in xrange(feature_count):
        observed = [sample_bernoulli(0.5) for _ in xrange(feature_count)]
{'fraction_non_alphanumeric': 0.07635206786850478, 'fraction_numerical': 0.0021208907741251328, 'mean_word_length': 4.3760683760683765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '87653', 'n_tokens_mistral': 585, 'n_tokens_neox': 571, 'n_words': 151}