columns

package
v0.1.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ColumnTypeBucket is the `FeatureColumn` of type bucket_column
	ColumnTypeBucket = 0
	// ColumnTypeEmbedding is the `FeatureColumn` of type embedding_column
	ColumnTypeEmbedding = 1
	// ColumnTypeNumeric is the `FeatureColumn` of type numeric_column
	ColumnTypeNumeric = 2
	// ColumnTypeCategoryID is the `FeatureColumn` of type category_id_column
	ColumnTypeCategoryID = 3
	// ColumnTypeSeqCategoryID is the `FeatureColumn` of type sequence_category_id_column
	ColumnTypeSeqCategoryID = 4
	// ColumnTypeCross is the `FeatureColumn` of type cross_column
	ColumnTypeCross = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketColumn

type BucketColumn struct {
	SourceColumn *NumericColumn
	Boundaries   []int
}

BucketColumn is the wrapper of `tf.feature_column.bucketized_column`

func (*BucketColumn) GenerateCode

func (bc *BucketColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements the FeatureColumn interface.

func (*BucketColumn) GetColumnType

func (bc *BucketColumn) GetColumnType() int

GetColumnType implements the FeatureColumn interface.

func (*BucketColumn) GetDelimiter

func (bc *BucketColumn) GetDelimiter() string

GetDelimiter implements the FeatureColumn interface.

func (*BucketColumn) GetDtype

func (bc *BucketColumn) GetDtype() string

GetDtype implements the FeatureColumn interface.

func (*BucketColumn) GetInputShape

func (bc *BucketColumn) GetInputShape() string

GetInputShape implements the FeatureColumn interface.

func (*BucketColumn) GetKey

func (bc *BucketColumn) GetKey() string

GetKey implements the FeatureColumn interface.

type CategoryIDColumn

type CategoryIDColumn struct {
	Key        string
	BucketSize int
	Delimiter  string
	Dtype      string
}

CategoryIDColumn is the wrapper of `tf.feature_column.categorical_column_with_identity`

func (*CategoryIDColumn) GenerateCode

func (cc *CategoryIDColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements the FeatureColumn interface.

func (*CategoryIDColumn) GetColumnType

func (cc *CategoryIDColumn) GetColumnType() int

GetColumnType implements the FeatureColumn interface.

func (*CategoryIDColumn) GetDelimiter

func (cc *CategoryIDColumn) GetDelimiter() string

GetDelimiter implements the FeatureColumn interface.

func (*CategoryIDColumn) GetDtype

func (cc *CategoryIDColumn) GetDtype() string

GetDtype implements the FeatureColumn interface.

func (*CategoryIDColumn) GetInputShape

func (cc *CategoryIDColumn) GetInputShape() string

GetInputShape implements the FeatureColumn interface.

func (*CategoryIDColumn) GetKey

func (cc *CategoryIDColumn) GetKey() string

GetKey implements the FeatureColumn interface.

type ColumnSpec

type ColumnSpec struct {
	ColumnName string
	IsSparse   bool
	Shape      []int
	DType      string
	Delimiter  string
	Vocabulary map[string]string // use a map to generate a list without duplication
	FeatureMap FeatureMap
}

ColumnSpec defines how to generate codes to parse column data to tensor/sparsetensor

func (*ColumnSpec) ToString

func (cs *ColumnSpec) ToString() string

ToString generates the debug string of ColumnSpec

type CrossColumn

type CrossColumn struct {
	Keys           []interface{}
	HashBucketSize int
}

CrossColumn is the wapper of `tf.feature_column.crossed_column` TODO(uuleon) specify the hash_key if needed

func (*CrossColumn) GenerateCode

func (cc *CrossColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements the FeatureColumn interface.

func (*CrossColumn) GetColumnType

func (cc *CrossColumn) GetColumnType() int

GetColumnType implements the FeatureColumn interface.

func (*CrossColumn) GetDelimiter

func (cc *CrossColumn) GetDelimiter() string

GetDelimiter implements the FeatureColumn interface.

func (*CrossColumn) GetDtype

func (cc *CrossColumn) GetDtype() string

GetDtype implements the FeatureColumn interface.

func (*CrossColumn) GetInputShape

func (cc *CrossColumn) GetInputShape() string

GetInputShape implements the FeatureColumn interface.

func (*CrossColumn) GetKey

func (cc *CrossColumn) GetKey() string

GetKey implements the FeatureColumn interface.

type EmbeddingColumn

type EmbeddingColumn struct {
	Key            string // only used when CategoryColumn = nil, feature derivation will fill up the details
	CategoryColumn interface{}
	Dimension      int
	Combiner       string
	Initializer    string
}

EmbeddingColumn is the wrapper of `tf.feature_column.embedding_column`

func (*EmbeddingColumn) GenerateCode

func (ec *EmbeddingColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements the FeatureColumn interface.

func (*EmbeddingColumn) GetColumnType

func (ec *EmbeddingColumn) GetColumnType() int

GetColumnType implements the FeatureColumn interface.

func (*EmbeddingColumn) GetDelimiter

func (ec *EmbeddingColumn) GetDelimiter() string

GetDelimiter implements the FeatureColumn interface.

func (*EmbeddingColumn) GetDtype

func (ec *EmbeddingColumn) GetDtype() string

GetDtype implements the FeatureColumn interface.

func (*EmbeddingColumn) GetInputShape

func (ec *EmbeddingColumn) GetInputShape() string

GetInputShape implements the FeatureColumn interface.

func (*EmbeddingColumn) GetKey

func (ec *EmbeddingColumn) GetKey() string

GetKey implements the FeatureColumn interface.

type FeatureColumn

type FeatureColumn interface {
	// NOTE: submitters need to know the columnSpec when generating
	// feature_column code. And we maybe use one compound column's data to generate
	// multiple feature columns, so return a list of strings.
	GenerateCode(cs *ColumnSpec) ([]string, error)
	GetKey() string

	// FIXME(typhoonzero): remove delimiter, dtype shape from feature column
	// get these from column spec claused or by feature derivation.
	GetDelimiter() string
	GetDtype() string
	GetInputShape() string

	GetColumnType() int
}

FeatureColumn is an interface that all types of feature columns should follow. featureColumn is used to generate feature column code.

type FeatureMap

type FeatureMap struct {
	Table     string
	Partition string
}

FeatureMap only used by codegen_alps, a table containing column parse informations.

type NumericColumn

type NumericColumn struct {
	Key       string
	Shape     []int
	Delimiter string
	Dtype     string
}

NumericColumn is the wrapper of `tf.feature_column.numeric_column`

func (*NumericColumn) GenerateCode

func (nc *NumericColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements FeatureColumn interface.

func (*NumericColumn) GetColumnType

func (nc *NumericColumn) GetColumnType() int

GetColumnType implements FeatureColumn interface.

func (*NumericColumn) GetDelimiter

func (nc *NumericColumn) GetDelimiter() string

GetDelimiter implements FeatureColumn interface.

func (*NumericColumn) GetDtype

func (nc *NumericColumn) GetDtype() string

GetDtype implements FeatureColumn interface.

func (*NumericColumn) GetInputShape

func (nc *NumericColumn) GetInputShape() string

GetInputShape implements FeatureColumn interface.

func (*NumericColumn) GetKey

func (nc *NumericColumn) GetKey() string

GetKey implements FeatureColumn interface.

type SequenceCategoryIDColumn

type SequenceCategoryIDColumn struct {
	Key        string
	BucketSize int
	Delimiter  string
	Dtype      string
}

SequenceCategoryIDColumn is the wrapper of `tf.feature_column.sequence_categorical_column_with_identity` NOTE: only used in tf >= 2.0 versions.

func (*SequenceCategoryIDColumn) GenerateCode

func (cc *SequenceCategoryIDColumn) GenerateCode(cs *ColumnSpec) ([]string, error)

GenerateCode implements the FeatureColumn interface.

func (*SequenceCategoryIDColumn) GetColumnType

func (cc *SequenceCategoryIDColumn) GetColumnType() int

GetColumnType implements the FeatureColumn interface.

func (*SequenceCategoryIDColumn) GetDelimiter

func (cc *SequenceCategoryIDColumn) GetDelimiter() string

GetDelimiter implements the FeatureColumn interface.

func (*SequenceCategoryIDColumn) GetDtype

func (cc *SequenceCategoryIDColumn) GetDtype() string

GetDtype implements the FeatureColumn interface.

func (*SequenceCategoryIDColumn) GetInputShape

func (cc *SequenceCategoryIDColumn) GetInputShape() string

GetInputShape implements the FeatureColumn interface.

func (*SequenceCategoryIDColumn) GetKey

func (cc *SequenceCategoryIDColumn) GetKey() string

GetKey implements the FeatureColumn interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL