Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shenweichen committed Oct 3, 2019
1 parent 8c4be10 commit af7fba2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
24 changes: 2 additions & 22 deletions deepctr_torch/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,17 @@ def __new__(cls, name, dimension, maxlen, combiner="mean", use_hash=False, dtype


def get_feature_names(feature_columns):
features = build_input_features(
feature_columns, include_varlen=True, include_fixlen=True)
features = build_input_features(feature_columns)
return list(features.keys())


# def get_varlen_feature_names(feature_columns):
# features = build_input_features(
# feature_columns, include_varlen=True, include_fixlen=False)
# return list(features.keys())


def get_inputs_list(inputs):
return list(chain(*list(map(lambda x: x.values(), filter(lambda x: x is not None, inputs)))))


def build_input_features(feature_columns, include_varlen=True, mask_zero=True, prefix='', include_fixlen=True):
input_features = OrderedDict()
def build_input_features(feature_columns):
features = OrderedDict()

start = 0

#if include_fixlen:
for feat in feature_columns:
feat_name = feat.name
if feat_name in features:
Expand All @@ -79,15 +68,6 @@ def build_input_features(feature_columns, include_varlen=True, mask_zero=True, p
start += feat.maxlen
else:
raise TypeError("Invalid feature column type,got",type(feat))
#if include_varlen:
# for feat in feature_columns:
# feat_name = feat.name
# if feat_name in features:
# continue
# if isinstance(feat, VarLenSparseFeat):
# features[feat_name] = (start, start + feat.maxlen)
# start += feat.maxlen

return features


Expand Down
3 changes: 2 additions & 1 deletion deepctr_torch/models/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def fit(self, x=None,
shuffle=True, ):
"""
:param x: Numpy array of training data (if the model has a single input), or list of Numpy arrays (if the model has multiple inputs).
:param x: Numpy array of training data (if the model has a single input), or list of Numpy arrays (if the model has multiple inputs).If input layers in the model are named, you can also pass a
dictionary mapping input names to Numpy arrays.
:param y: Numpy array of target (label) data (if the model has a single output), or list of Numpy arrays (if the model has multiple outputs).
:param batch_size: Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 256.
:param epochs: Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
Expand Down

0 comments on commit af7fba2

Please sign in to comment.