Пример #1
0
def twice(*args):
    'Run a command twice'
    argv = [sys.argv[0]] + list(args)

    print('first time:')
    parsable(argv)

    print('second time:')
    parsable(argv)
Пример #2
0
@parsable
def extract(filename):
    """Extract code from markdown file."""
    TODO()


@parsable
def annotate(*files):
    '''
    Annotate markdown files with high-latency results of analyst.
    '''
    TODO()


@parsable
def suggest(filename):
    '''
    Get real-time feedback from low-latency results of analyst.
    '''
    TODO()


@parsable
def precommit():
    """Reformat and annotate all code before a git commit."""
    reformat(CORPUS)


if __name__ == '__main__':
    parsable()
Пример #3
0
            npred_held_out,
        ) for idx in xrange(epochs)
    ]
    filename = get_results_filename(shortname, n_test, iters, epochs, schedule,
                                    seed)
    filepath = '%s.json' % (os.path.join(PATH_RESULTS, filename), )
    with open(filepath, 'w') as fptr:
        json.dump(
            {
                'path_dataset': path_dataset,
                'n_test': n_test,
                'xs_train': xs_train.tolist(),
                'ys_train': ys_train.tolist(),
                'xs_test': xs_test.tolist(),
                'ys_test': ys_test.tolist(),
                'xs_probe': xs_probe.tolist(),
                'n_iters': iters,
                'n_epochs': epochs,
                'nprobe_held_in': nprobe_held_in,
                'npred_held_in': npred_held_in,
                'npred_held_out': npred_held_out,
                'seed': seed,
                'statistics': statistics,
                'schedule': schedule,
            }, fptr)
    print filepath


if __name__ == '__main__':
    parsable()
Пример #4
0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import multiprocessing

from parsable import parsable

from treecat.config import make_config
from treecat.format import guess_schema
from treecat.format import import_data
from treecat.format import pickle_dump
from treecat.format import pickle_load

parsable = parsable.Parsable()
parsable(guess_schema)
parsable(import_data)


@parsable
def train(dataset_in, ensemble_out, **options):
    """Train a TreeCat ensemble model on imported data."""
    from treecat.training import train_ensemble
    dataset = pickle_load(dataset_in)
    table = dataset['table']
    tree_prior = dataset['schema']['tree_prior']
    config = make_config(**options)
    ensemble = train_ensemble(table, tree_prior, config)
    pickle_dump(ensemble, ensemble_out)