Skip to content

Commit 158d2f8

Browse files
author
Daniel Sparing
authored
expand_dims to correctly test multi-hot
Without expanding dimensions, multi-hot encoded columns are not correctly illustrated (they will be parsed as single-record multi-label, not single-label multi-record). (Another question is whether we need multi-hot for these columns instead of one-hot, as they are not multi-label?)
1 parent 9aa0832 commit 158d2f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

site/en/tutorials/structured_data/preprocessing_layers.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@
502502
"test_type_layer = get_category_encoding_layer(name='Type',\n",
503503
" dataset=train_ds,\n",
504504
" dtype='string')\n",
505-
"test_type_layer(test_type_col)"
505+
"test_type_layer(tf.expand_dims(test_type_col, -1))"
506506
]
507507
},
508508
{
@@ -527,7 +527,7 @@
527527
" dataset=train_ds,\n",
528528
" dtype='int64',\n",
529529
" max_tokens=5)\n",
530-
"test_age_layer(test_age_col)"
530+
"test_age_layer(tf.expand_dims(test_age_col, -1))"
531531
]
532532
},
533533
{

0 commit comments

Comments
 (0)