tf.contrib.layers.transform_features
Возвращает преобразованные признаки на основе столбцов признаков, переданных в качестве входных данных.
tf.contrib.layers.transform_features(
features, feature_columns
)
Пример:
columns_to_tensor = transform_features(features=features,
feature_columns=feature_columns)
# Where my_features are:
# Define features and transformations
sparse_feature_a = sparse_column_with_keys(
column_name="sparse_feature_a", keys=["AB", "CD", ...])
embedding_feature_a = embedding_column(
sparse_id_column=sparse_feature_a, dimension=3, combiner="sum")
sparse_feature_b = sparse_column_with_hash_bucket(
column_name="sparse_feature_b", hash_bucket_size=1000)
embedding_feature_b = embedding_column(
sparse_id_column=sparse_feature_b, dimension=16, combiner="sum")
crossed_feature_a_x_b = crossed_column(
columns=[sparse_feature_a, sparse_feature_b], hash_bucket_size=10000)
real_feature = real_valued_column("real_feature")
real_feature_buckets = bucketized_column(
source_column=real_feature, boundaries=[...])
feature_columns = [embedding_feature_b,
real_feature_buckets,
embedding_feature_a]
| Аргументы | |
|---|---|
features | Словарь признаков. |
feature_columns | Итерируемый объект, содержащий все столбцы признаков. Все элементы должны быть экземплярами классов, производных от _FeatureColumn. |
| Возвращаемое значение | |
|---|---|
Сопоставление FeatureColumn с соответствующими значениями dict и Tensor. |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/layers/transform_features