examples/char-lstm-classification.py
def split_data_train_eval(category_lines, frac):
    r"""
    Split the data into a training and a evaluation set with a specified split
    'frac' is the percentage of data tp retain in the training set
    Returns the training and the validation sets as dictionaries
    """
    category_lines_train = {}
    category_lines_eval = {}
    for key in category_lines.keys():
        category_lines_train[key] = []
        category_lines_eval[key] = []
    for key in category_lines.keys():
        for val in category_lines[key]:
            if random.uniform(0, 1) < frac:
                category_lines_train[key].append(val)
            else:
                category_lines_eval[key].append(val)
    return category_lines_train, category_lines_eval
r"""
    Split the data into a training and a evaluation set with a specified split
    'frac' is the percentage of data tp retain in the training set
    Returns the training and the validation sets as dictionaries
    
r"""
Split the data into a training and a evaluation set with a specified split
'frac' is the percentage of data tp retain in the training set
Returns the training and the validation sets as dictionaries
r " " " Split the data into a training and a evaluation set with a specified split ' frac ' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries
def split_data_train_eval(category_lines, frac):
    category_lines_train = {}
    category_lines_eval = {}
    for key in category_lines.keys():
        category_lines_train[key] = []
        category_lines_eval[key] = []
    for key in category_lines.keys():
        for val in category_lines[key]:
            if random.uniform(0, 1) < frac:
                category_lines_train[key].append(val)
            else:
                category_lines_eval[key].append(val)
    return category_lines_train, category_lines_eval
def split_data_train_eval ( category_lines , frac ) : category_lines_train = { } category_lines_eval = { } for key in category_lines . keys ( ) : category_lines_train [ key ] = [ ] category_lines_eval [ key ] = [ ] for key in category_lines . keys ( ) : for val in category_lines [ key ] : if random . uniform ( 0 , 1 ) < frac : category_lines_train [ key ] . append ( val ) else : category_lines_eval [ key ] . append ( val ) return category_lines_train , category_lines_eval
r"""
Split the data into a training and a evaluation set with a specified split
'frac' is the percentage of data tp retain in the training set
Returns the training and the validation sets as dictionaries
r " " " Split the data into a training and a evaluation set with a specified split ' frac ' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries
r"""
    Split the data into a training and a evaluation set with a specified split
    'frac' is the percentage of data tp retain in the training set
    Returns the training and the validation sets as dictionaries
    """
category_lines
frac