Skip to content

Commit

Permalink
Improve error message in cross_column re:hashing.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 156923445
  • Loading branch information
ispirmustafa authored and tensorflower-gardener committed May 23, 2017
1 parent 8ac9eb6 commit c3cc632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tensorflow/python/feature_column/feature_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,8 +1165,9 @@ def crossed_column(keys, hash_bucket_size, hash_key=None):
'Given: {}'.format(key))
if isinstance(key, _HashedCategoricalColumn):
raise ValueError(
'_HashedCategoricalColumn is not supported. Instead, use the feature '
'name as a string. Given: {}'.format(key))
'categorical_column_with_hash_bucket is not supported for crossing. '
'Hashing before crossing will increase probability of collision. '
'Instead, use the feature name as a string. Given: {}'.format(key))
return _CrossedColumn(
keys=tuple(keys), hash_bucket_size=hash_bucket_size,
hash_key=hash_key)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/feature_column/feature_column_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def test_key_type_unsupported(self):
fc.crossed_column(['a', fc.numeric_column('c')], 10)

with self.assertRaisesRegexp(
ValueError, '_HashedCategoricalColumn is not supported'):
ValueError, 'categorical_column_with_hash_bucket is not supported'):
fc.crossed_column(
['a', fc.categorical_column_with_hash_bucket('c', 10)], 10)

Expand Down

0 comments on commit c3cc632

Please sign in to comment.