neuroscout/populate/setup.py
def extract_from_json(extract_config, dataset_name=None, task_name=None):
    """ Applies JSON file specifying conversion and extractions to
    specifed tasks.

    Args:
        extract_config: JSON specifying the arguments to each step
          See: config/transformers.json for full example
        dataset_name: dataset name. If none, applied to all datasets / tasks
        task_name: If dataset_name is specified, can apply to specific task
    """

    if dataset_name is None and task_name is not None:
        raise Exception(
            "If no dataset_name is specified, no task_name can be set.")

    with open(extract_config, 'r') as f:
        config = json.load(f)

    """ Convert stimuli """
    converters = config.get('converters', None)
    if converters:
        print("Converting... {}".format(converters))
        convert_stimuli(converters, dataset_name, task_name)

    """ Extract features from applicable stimuli """
    extractor_graphs = config.get('extractors', None)
    if extractor_graphs:
        print("Extracting...")
        extract_features(extractor_graphs, dataset_name, task_name)

    """ Extract features that require pre-tokenization """
    tokenized_extractors = config.get('tokenized_extractors', None)
    if tokenized_extractors:
        print("Tokenizing and extracting... {}".format(
            tokenized_extractors))
        extract_tokenized_features(
            tokenized_extractors, dataset_name, task_name)

    """ Apply transformations """
    transformations = config.get("transformations", [])

    dataset_names = [dataset_name] if dataset_name else \
        [d.name for d in Dataset.query.filter_by(active=True)]
    for args in transformations:
        print("Applying transformation... {}".format(args))
        for name in dataset_names:
            post = Postprocessing(dataset_name, task_name)
            post.apply_transformation(**args)
 Applies JSON file specifying conversion and extractions to
    specifed tasks.

    Args:
        extract_config: JSON specifying the arguments to each step
          See: config/transformers.json for full example
        dataset_name: dataset name. If none, applied to all datasets / tasks
        task_name: If dataset_name is specified, can apply to specific task
    
Applies JSON file specifying conversion and extractions to
specifed tasks.
Applies JSON file specifying conversion and extractions to specifed tasks .
def extract_from_json(extract_config, dataset_name=None, task_name=None):
    if dataset_name is None and task_name is not None:
        raise Exception(
            "If no dataset_name is specified, no task_name can be set.")
    with open(extract_config, 'r') as f:
        config = json.load(f)
    converters = config.get('converters', None)
    if converters:
        print("Converting... {}".format(converters))
        convert_stimuli(converters, dataset_name, task_name)
    extractor_graphs = config.get('extractors', None)
    if extractor_graphs:
        print("Extracting...")
        extract_features(extractor_graphs, dataset_name, task_name)
    tokenized_extractors = config.get('tokenized_extractors', None)
    if tokenized_extractors:
        print("Tokenizing and extracting... {}".format(
            tokenized_extractors))
        extract_tokenized_features(
            tokenized_extractors, dataset_name, task_name)
    transformations = config.get("transformations", [])
    dataset_names = [dataset_name] if dataset_name else \
        [d.name for d in Dataset.query.filter_by(active=True)]
    for args in transformations:
        print("Applying transformation... {}".format(args))
        for name in dataset_names:
            post = Postprocessing(dataset_name, task_name)
            post.apply_transformation(**args)
def extract_from_json ( extract_config , dataset_name = None , task_name = None ) : if dataset_name is None and task_name is not None : raise Exception ( "If no dataset_name is specified, no task_name can be set." ) with open ( extract_config , 'r' ) as f : config = json . load ( f ) """ Convert stimuli """ converters = config . get ( 'converters' , None ) if converters : print ( "Converting... {}" . format ( converters ) ) convert_stimuli ( converters , dataset_name , task_name ) """ Extract features from applicable stimuli """ extractor_graphs = config . get ( 'extractors' , None ) if extractor_graphs : print ( "Extracting..." ) extract_features ( extractor_graphs , dataset_name , task_name ) """ Extract features that require pre-tokenization """ tokenized_extractors = config . get ( 'tokenized_extractors' , None ) if tokenized_extractors : print ( "Tokenizing and extracting... {}" . format ( tokenized_extractors ) ) extract_tokenized_features ( tokenized_extractors , dataset_name , task_name ) """ Apply transformations """ transformations = config . get ( "transformations" , [ ] ) dataset_names = [ dataset_name ] if dataset_name else [ d . name for d in Dataset . query . filter_by ( active = True ) ] for args in transformations : print ( "Applying transformation... {}" . format ( args ) ) for name in dataset_names : post = Postprocessing ( dataset_name , task_name ) post . apply_transformation ( ** args )
Applies JSON file specifying conversion and extractions to
specifed tasks.
Applies JSON file specifying conversion and extractions to specifed tasks .
""" Applies JSON file specifying conversion and extractions to
    specifed tasks.

    Args:
        extract_config: JSON specifying the arguments to each step
          See: config/transformers.json for full example
        dataset_name: dataset name. If none, applied to all datasets / tasks
        task_name: If dataset_name is specified, can apply to specific task
    """ """ Convert stimuli """ """ Extract features from applicable stimuli """ """ Extract features that require pre-tokenization """ """ Apply transformations """
extract_config
JSON specifying the arguments to each step
See: config/transformers.json for full example
JSON specifying the arguments to each step See : config / transformers . json for full example
dataset_name
dataset name. If none, applied to all datasets / tasks
dataset name . If none applied to all datasets / tasks
task_name
If dataset_name is specified, can apply to specific task
If dataset_name is specified can apply to specific task