Loads train and test data, and possibly loads predictions.
(train_data_path, test_data_path,
prediction_path)
| 44 | |
| 45 | |
| 46 | def load_data(train_data_path, test_data_path, |
| 47 | prediction_path): |
| 48 | """Loads train and test data, and possibly loads predictions.""" |
| 49 | train_examples = _load_examples(train_data_path) |
| 50 | test_examples = _load_examples(test_data_path) |
| 51 | if prediction_path: |
| 52 | predictions = _load_predictions(prediction_path) |
| 53 | num_predictions = len(predictions) |
| 54 | num_test_examples = len(test_examples) |
| 55 | if num_predictions != num_test_examples: |
| 56 | raise RuntimeError( |
| 57 | "#predictions ({}) must equal #test_examples ({})!".format( |
| 58 | num_predictions, num_test_examples)) |
| 59 | else: |
| 60 | predictions = None |
| 61 | return train_examples, test_examples, predictions |
| 62 | |
| 63 | |
| 64 | def write_to_tsv(examples, output_filename): |
nothing calls this directly
no test coverage detected
searching dependent graphs…