def test_weight_column_should_not_be_used_as_feature(self): with self.assertRaisesRegexp(ValueError, 'weight_column should not be used as feature'): parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b', weight_column=fc.numeric_column('a'))
def test_weight_column_should_not_be_used_as_feature(self): with self.assertRaisesRegexp(ValueError, 'weight_column should not be used as feature'): parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b', weight_column=fc.numeric_column('a'))
def test_weight_column_should_be_a_numeric_column(self): with self.assertRaisesRegexp(ValueError, 'tf.feature_column.numeric_column'): not_a_numeric_column = 3 parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b', weight_column=not_a_numeric_column)
def test_weight_column_should_be_a_numeric_column(self): with self.assertRaisesRegexp(ValueError, 'tf.feature_column.numeric_column'): not_a_numeric_column = 3 parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b', weight_column=not_a_numeric_column)
def test_defaults(self): parsing_spec = parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b') expected_spec = { 'a': parsing_ops.FixedLenFeature((1,), dtype=dtypes.float32), 'b': parsing_ops.FixedLenFeature((1,), dtype=dtypes.float32), } self.assertDictEqual(expected_spec, parsing_spec)
def test_defaults(self): parsing_spec = parsing_utils.regressor_parse_example_spec( feature_columns=[fc.numeric_column('a')], label_key='b') expected_spec = { 'a': parsing_ops.FixedLenFeature((1,), dtype=dtypes.float32), 'b': parsing_ops.FixedLenFeature((1,), dtype=dtypes.float32), } self.assertDictEqual(expected_spec, parsing_spec)