tft.TFTransformOutput

Class TFTransformOutput

A wrapper around the output of the tf.Transform.

Args:

  • transform_output_dir: The directory containig tf.Transform output.

__init__

__init__(transform_output_dir)

Properties

post_transform_statistics_path

Returns the path to the post-transform datum statistics.

pre_transform_statistics_path

Returns the path to the pre-transform datum statistics.

raw_metadata

A DatasetMetadata.

Returns:

A DatasetMetadata

transform_savedmodel_dir

A python str.

transformed_metadata

A DatasetMetadata.

Methods

load_transform_graph

load_transform_graph()

Load the transform graph without replacing any placeholders.

This is necessary to ensure that variables in the transform graph are included in the training checkpoint when using tf.Estimator. This should be called in the training input_fn.

num_buckets_for_transformed_feature

num_buckets_for_transformed_feature(name)

Returns the number of buckets for an integerized transformed feature.

raw_feature_spec

raw_feature_spec()

Returns a feature_spec for the raw features.

Returns:

A dict from feature names to FixedLenFeature/SparseFeature/VarLenFeature.

transform_raw_features

transform_raw_features(raw_features)

Takes a dict of tensors representing raw features and transforms them.

Takes a dictionary of Tensors or SparseTensors that represent the raw features, and applies the transformation defined by tf.Transform.

Args:

  • raw_features: A dict whose keys are feature names and values are Tensors or SparseTensors.

Returns:

A dict whose keys are feature names and values are Tensors or SparseTensors representing transformed features.

transformed_feature_spec

transformed_feature_spec()

Returns a feature_spec for the transformed features.

Returns:

A dict from feature names to FixedLenFeature/SparseFeature/VarLenFeature.

vocabulary_by_name

vocabulary_by_name(vocab_filename)

Like vocabulary_file_by_name but returns a list.

vocabulary_file_by_name

vocabulary_file_by_name(vocab_filename)

Returns the vocabulary file path created in the preprocessing function.

vocab_filename must be the name used as the vocab_filename argument to tft.compute_and_apply_vocabulary or tft.vocabulary. By convention, this should be the name of the feature that the vocab was computed for, where possible.

Args:

  • vocab_filename: The relative filename to lookup.

vocabulary_size_by_name

vocabulary_size_by_name(vocab_filename)

Like vocabulary_file_by_name, but returns the size of vocabulary.

Class Members

POST_TRANSFORM_FEATURE_STATS_PATH

PRE_TRANSFORM_FEATURE_STATS_PATH

RAW_METADATA_DIR

TRANSFORMED_METADATA_DIR

TRANSFORM_FN_DIR