# Path: tensorflow_transform/tf_metadata/dataset_metadata.py
# class DatasetMetadata:
#   def __init__(self, schema: schema_pb2.Schema):
#   def from_feature_spec(
#       cls: Type[_DatasetMetadataType],
#       feature_spec: Mapping[str, common_types.FeatureSpecType],
#       domains: Optional[Mapping[str, common_types.DomainType]] = None
#   ) -> _DatasetMetadataType:
#   def schema(self) -> schema_pb2.Schema:
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __repr__(self):


import argparse
import os
import tempfile
import apache_beam as beam
import tensorflow.compat.v2 as tf
import tensorflow_transform as tft
import tensorflow_transform.beam as tft_beam
from tensorflow_transform.tf_metadata import dataset_metadata
from tfx_bsl.coders.example_coder import RecordBatchToExamples
from tfx_bsl.public import tfxio
    'native-country',
]
NUMERIC_FEATURE_KEYS = [
    'age',
    'capital-gain',
    'capital-loss',
    'hours-per-week',
]
OPTIONAL_NUMERIC_FEATURE_KEYS = [
    'education-num',
]
LABEL_KEY = 'label'


ORDERED_CSV_COLUMNS = [
    'age', 'workclass', 'fnlwgt', 'education', 'education-num',
    'marital-status', 'occupation', 'relationship', 'race', 'sex',
    'capital-gain', 'capital-loss', 'hours-per-week', 'native-country', 'label'
]


RAW_DATA_FEATURE_SPEC = dict([(name, tf.io.FixedLenFeature([], tf.string))
                              for name in CATEGORICAL_FEATURE_KEYS] +
                             [(name, tf.io.FixedLenFeature([], tf.float32))
                              for name in NUMERIC_FEATURE_KEYS] +
                             [(name, tf.io.VarLenFeature(tf.float32))
                              for name in OPTIONAL_NUMERIC_FEATURE_KEYS] +
                             [(LABEL_KEY,
                               tf.io.FixedLenFeature([], tf.string))])


# Path: tensorflow_transform/tf_metadata/dataset_metadata.py
# class DatasetMetadata:
#   def __init__(self, schema: schema_pb2.Schema):
#   def from_feature_spec(
#       cls: Type[_DatasetMetadataType],
#       feature_spec: Mapping[str, common_types.FeatureSpecType],
#       domains: Optional[Mapping[str, common_types.DomainType]] = None
#   ) -> _DatasetMetadataType:
#   def schema(self) -> schema_pb2.Schema:
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __repr__(self):


# Path: examples/census_example_common.py
import argparse
import os
import tempfile
import apache_beam as beam
import tensorflow.compat.v2 as tf
import tensorflow_transform as tft
import tensorflow_transform.beam as tft_beam
from tensorflow_transform.tf_metadata import dataset_metadata
from tfx_bsl.coders.example_coder import RecordBatchToExamples
from tfx_bsl.public import tfxio

    'native-country',
]
NUMERIC_FEATURE_KEYS = [
    'age',
    'capital-gain',
    'capital-loss',
    'hours-per-week',
]
OPTIONAL_NUMERIC_FEATURE_KEYS = [
    'education-num',
]
LABEL_KEY = 'label'


ORDERED_CSV_COLUMNS = [
    'age', 'workclass', 'fnlwgt', 'education', 'education-num',
    'marital-status', 'occupation', 'relationship', 'race', 'sex',
    'capital-gain', 'capital-loss', 'hours-per-week', 'native-country', 'label'
]


RAW_DATA_FEATURE_SPEC = dict([(name, tf.io.FixedLenFeature([], tf.string))
                              for name in CATEGORICAL_FEATURE_KEYS] +
                             [(name, tf.io.FixedLenFeature([], tf.float32))
                              for name in NUMERIC_FEATURE_KEYS] +
                             [(name, tf.io.VarLenFeature(tf.float32))
                              for name in OPTIONAL_NUMERIC_FEATURE_KEYS] +
                             [(LABEL_KEY,
                               tf.io.FixedLenFeature([], tf.string))])


_SCHEMA = dataset_metadata.DatasetMetadata.from_feature_spec(