def cfg_from_file(filename):
    """
     Load a config file and merge it into the default options.

     Parameters
     ----------
     filename : string
         Path to filename.
     """
    import yaml
    with open(filename, 'r') as f:
        return eDict(yaml.load(f))
示例#2
0
def cfg_from_file(filename):
    '''
    Load a config file and merge it into the default options.

    Parameters
    ----------
    filename : string
        Path to filename.

    '''
    import yaml
    with open(filename, 'r') as f:
        yaml_cfg = eDict(yaml.load(f))

    _merge_a_into_b(yaml_cfg, __C)
""" The module storing the general configuration information for the code
"""
from easydict import EasyDict as eDict
import os

generalConf = eDict({})

# Set the paths required for setting up and preprocessing the data
generalConf.DATA_PATH = os.path.join(os.path.abspath("."), "../../Data")
generalConf.TRAIN_DATA = os.path.join(generalConf.DATA_PATH, "train.csv")
generalConf.TEST_DATA = os.path.join(generalConf.DATA_PATH, "test.csv")
generalConf.SAMPLE_SUBMISSION = os.path.join(generalConf.DATA_PATH,
                                             "sample_submission.csv")

# Set the constants for the data
generalConf.MAX_WORD_LENGTH = 800  # derived from the common/visualizations/word_lengths_train.png plot
generalConf.MIN_WORD_FREQ = 40
generalConf.MAX_WORD_FREQ = 40000  # The above two values have been derived
generalConf.NUM_CLASSES = 6
# from the word_frequencies.png visualization

# Set the constant files
generalConf.PICKLE_FILE = os.path.join(generalConf.DATA_PATH,
                                       "plug_and_play.pickle")

if __name__ == '__main__':
    print("Loading the General Configuration ...")
    print("\n\nGENERAL CONFIGURATION:\n")
    for key, value in generalConf.items():
        print(key, "->", value)
示例#4
0
from __future__ import division
from __future__ import print_function

from easydict import EasyDict as eDict
import numpy as np


__C = eDict()
cfg = __C

__C.CONFIG_NAME = 'ConNet'
__C.DATASET_NAME = 'SVHN'
__C.SEED = 1234

# Training options
__C.TRAIN = eDict()
__C.TRAIN.DATASET_SPLIT = 'train'
__C.TRAIN.VALID_SPLIT = 0.8
__C.TRAIN.SAMPLE_SIZE = 100
__C.TRAIN.BATCH_SIZE = 32
__C.TRAIN.NUM_EPOCHS = 5
__C.TRAIN.LR = 0.001
__C.TRAIN.MOM = 0.9


def _merge_a_into_b(a, b):
    '''
    Merge config dictionary a into config dictionary b, clobbering the
    options in b whenever they are also specified in a.

    Parameters
""" The module storing the Model specific configuration
"""
from easydict import EasyDict as eDict

modelConf = eDict({})

# Set the constants for the Model
modelConf.FILTER_SIZE = 5  # all 1D convolutional filters have a width of 5
modelConf.TRAINING_PARTITION = 99  # percentage for training data. rest is the validation set
modelConf.EMB_SIZE = 16  # size of the embedded input sequences

if __name__ == '__main__':
    print("Loading the General Configuration ...")
    print("\n\nGENERAL CONFIGURATION:\n")
    for key, value in modelConf.items():
        print(key, "->", value)