| 437 | # generate dataset pipline |
| 438 | def build_model_input(filename, batch_size, num_epochs): |
| 439 | def parse_csv(value): |
| 440 | tf.logging.info('Parsing {}'.format(filename)) |
| 441 | cate_defaults = [[' '] for i in range(0, 5)] |
| 442 | label_defaults = [[0]] |
| 443 | column_headers = TRAIN_DATA_COLUMNS |
| 444 | record_defaults = label_defaults + cate_defaults |
| 445 | columns = tf.io.decode_csv(value, |
| 446 | record_defaults=record_defaults, |
| 447 | field_delim='\t') |
| 448 | all_columns = collections.OrderedDict(zip(column_headers, columns)) |
| 449 | |
| 450 | labels = all_columns.pop(LABEL_COLUMN[0]) |
| 451 | features = all_columns |
| 452 | return features, labels |
| 453 | |
| 454 | def parse_parquet(value): |
| 455 | labels = value.pop(LABEL_COLUMN[0]) |