SparseFeatureColumn
Defined in tensorflow/contrib/linear_optimizer/python/ops/sparse_feature_column.py
.
Represents a sparse feature column.
Contains three tensors representing a sparse feature column, they are example indices (int64
), feature indices (int64
), and feature values (float
). Feature weights are optional, and are treated as 1.0f
if missing.
For example, consider a batch of 4 examples, which contains the following features in a particular SparseFeatureColumn
:
This SparseFeatureColumn will be represented as follows:
<0, 5, 1> <1, 6, 1> <1, 10, 0.5> <3, 2, 1> <3, 2, 1>
For a batch of 2 examples below:
is represented by SparseFeatureColumn
as:
<0, 5, 1> <1, 6, 1>
example_indices
The example indices represented as a dense tensor.
A 1-D Tensor of int64 with shape [N]
.
feature_indices
The feature indices represented as a dense tensor.
A 1-D Tensor of int64 with shape [N]
.
feature_values
The feature values represented as a dense tensor.
May return None, or a 1-D Tensor of float32 with shape [N]
.
__init__
__init__( example_indices, feature_indices, feature_values )
Creates a SparseFeatureColumn
representation.
example_indices
: A 1-D int64 tensor of shape [N]
. Also, accepts python lists, or numpy arrays.feature_indices
: A 1-D int64 tensor of shape [N]
. Also, accepts python lists, or numpy arrays.feature_values
: An optional 1-D tensor float tensor of shape [N]
. Also, accepts python lists, or numpy arrays.A SparseFeatureColumn
© 2018 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/api_docs/python/tf/contrib/linear_optimizer/SparseFeatureColumn