MCPcopy
hub / github.com/shenweichen/DeepCTR / build_input_features

Function build_input_features

deepctr/feature_column.py:128–149  ·  view source on GitHub ↗
(feature_columns, prefix='')

Source from the content-addressed store, hash-verified

126
127
128def build_input_features(feature_columns, prefix=''):
129 input_features = OrderedDict()
130 for fc in feature_columns:
131 if isinstance(fc, SparseFeat):
132 input_features[fc.name] = Input(
133 shape=(1,), name=prefix + fc.name, dtype=fc.dtype)
134 elif isinstance(fc, DenseFeat):
135 input_features[fc.name] = Input(
136 shape=(fc.dimension,), name=prefix + fc.name, dtype=fc.dtype)
137 elif isinstance(fc, VarLenSparseFeat):
138 input_features[fc.name] = Input(shape=(fc.maxlen,), name=prefix + fc.name,
139 dtype=fc.dtype)
140 if fc.weight_name is not None:
141 input_features[fc.weight_name] = Input(shape=(fc.maxlen, 1), name=prefix + fc.weight_name,
142 dtype="float32")
143 if fc.length_name is not None:
144 input_features[fc.length_name] = Input((1,), name=prefix + fc.length_name, dtype='int32')
145
146 else:
147 raise TypeError("Invalid feature column type,got", type(fc))
148
149 return input_features
150
151
152def get_linear_logit(features, feature_columns, units=1, use_bias=False, seed=1024, prefix='linear',

Callers 15

get_feature_namesFunction · 0.85
FLENFunction · 0.85
DeepFEFMFunction · 0.85
FNNFunction · 0.85
DIFMFunction · 0.85
EDCNFunction · 0.85
DCNFunction · 0.85
MLRFunction · 0.85
DCNMixFunction · 0.85
FGCNNFunction · 0.85
IFMFunction · 0.85
xDeepFMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected