|
| 1 | +# Copyright (C) 2020 Intel Corporation |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
| 5 | +import argparse |
| 6 | +from bench import measure_function_time, parse_args, load_data, print_output |
| 7 | +from cuml import train_test_split |
| 8 | + |
| 9 | +parser = argparse.ArgumentParser( |
| 10 | + description='cuml train_test_split benchmark') |
| 11 | +parser.add_argument('--train-size', type=float, default=0.75, |
| 12 | + help='Size of training subset') |
| 13 | +parser.add_argument('--test-size', type=float, default=0.25, |
| 14 | + help='Size of testing subset') |
| 15 | +parser.add_argument('--shuffle', default=False, action='store_true', |
| 16 | + help='Perform data shuffle before splitting') |
| 17 | +params = parse_args(parser) |
| 18 | + |
| 19 | +# Load generated data |
| 20 | +X, y, _, _ = load_data(params) |
| 21 | + |
| 22 | +tts_params = { |
| 23 | + 'train_size': params.train_size, |
| 24 | + 'test_size': params.test_size, |
| 25 | + 'shuffle': params.shuffle, |
| 26 | + 'random_state': params.seed |
| 27 | +} |
| 28 | + |
| 29 | +time, _ = measure_function_time(train_test_split, X=X, y=y, params=params) |
| 30 | + |
| 31 | +columns = ('batch', 'arch', 'prefix', 'function', 'threads', 'dtype', 'size', |
| 32 | + 'time') |
| 33 | + |
| 34 | +print_output(library='cuml', algorithm='train_test_split', |
| 35 | + stages=['training'], columns=columns, params=params, |
| 36 | + functions=['train_test_split'], times=[time], accuracies=[None], |
| 37 | + accuracy_type=None, data=[X], alg_params=tts_params) |
0 commit comments