e90157e7f01c85e9ef22f9679f1a40bda0efb51f,src/utils/utils.py,,split_data,#,26

Before Change


        return imresize(image_array, size)

def split_data(ground_truth_data, training_ratio=.8, do_shuffle=False):
    ground_truth_keys = sorted(ground_truth_data.keys())
    if do_shuffle == True:
        shuffle(ground_truth_keys)
    num_train = int(round(training_ratio * len(ground_truth_keys)))
    train_keys = ground_truth_keys[:num_train]
    validation_keys = ground_truth_keys[num_train:]
    return train_keys, validation_keys

After Change


def split_data(x, y, validation_split=.2):
    num_samples = len(x)
    num_train_samples = int((1 - validation_split)*num_samples)
    train_x = x[:num_train_samples]
    train_y = y[:num_train_samples]
    val_x = x[num_train_samples:]
    val_y = y[num_train_samples:]
    train_data = (train_x, train_y)
    val_data = (val_x, val_y)
    return train_data, val_data

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: oarriaga/face_classification
Commit Name: e90157e7f01c85e9ef22f9679f1a40bda0efb51f
Time: 2017-06-30
Author: arriaga.camargo@gmail.com
File Name: src/utils/utils.py
Class Name:
Method Name: split_data


Project Name: kymatio/kymatio
Commit Name: 60c2e01bfc93bc01da21b79ebe9f222e601e1931
Time: 2020-02-18
Author: janden@flatironinstitute.org
File Name: kymatio/scattering2d/core/scattering2d.py
Class Name:
Method Name: scattering2d


Project Name: lovit/soynlp
Commit Name: c345d6b38dcfa57decc199db5e2076ec6ad049de
Time: 2018-11-07
Author: soy.lovit@gmail.com
File Name: soynlp/pos/_pos.py
Class Name: POSExtractor
Method Name: extract