(conversations, split_ratio=[0.8, 0.1, 0.1])
return train, valid, test
Train/Validation/Test split by randomly selected movies
Train/Validation/Test split by randomly selected movies
Train / Validation / Test split by randomly selected movies
def train_valid_test_split_by_conversation(conversations, split_ratio=[0.8, 0.1, 0.1]):
    """Train/Validation/Test split by randomly selected movies"""

    train_ratio, valid_ratio, test_ratio = split_ratio
    assert train_ratio + valid_ratio + test_ratio == 1.0

    n_conversations = len(conversations)

    # Random shuffle movie list
    random.seed(0)
    random.shuffle(conversations)

    # Train / Validation / Test Split
    train_split = int(n_conversations * train_ratio)
    valid_split = int(n_conversations * (train_ratio + valid_ratio))

    train = conversations[:train_split]
    valid = conversations[train_split:valid_split]
    test = conversations[valid_split:]

    print(f'Train set: {len(train)} conversations')
    print(f'Validation set: {len(valid)} conversations')
    print(f'Test set: {len(test)} conversations')

    return train, valid, test
def train_valid_test_split_by_conversation ( conversations , split_ratio = [ 0.8 , 0.1 , 0.1 ] ) : train_ratio , valid_ratio , test_ratio = split_ratio assert train_ratio + valid_ratio + test_ratio == 1.0 n_conversations = len ( conversations ) # Random shuffle movie list random . seed ( 0 ) random . shuffle ( conversations ) # Train / Validation / Test Split train_split = int ( n_conversations * train_ratio ) valid_split = int ( n_conversations * ( train_ratio + valid_ratio ) ) train = conversations [ : train_split ] valid = conversations [ train_split : valid_split ] test = conversations [ valid_split : ] print ( f'Train set: {len(train)} conversations' ) print ( f'Validation set: {len(valid)} conversations' ) print ( f'Test set: {len(test)} conversations' ) return train , valid , test