// 2.count //unique features for each sparse field and generate feature config for sequence feature
sparse_feature_dim = {feat: data[feat].nunique() for feat in sparse_features}
sequence_feature = [VarLenFeature("genres", len(key2index), max_len, "mean")]
// 3.generate input data for model
sparse_input = [data[feat].values for feat in sparse_feature_dim]
After Change
// 2.count //unique features for each sparse field and generate feature config for sequence feature
sparse_feat_list = [SingleFeat(feat, data[feat].nunique())
for feat in sparse_features]
sequence_feature = [VarLenFeat("genres", len(
key2index) + 1, max_len, "mean")] // Notice : value 0 is for padding for sequence input feature
// 3.generate input data for model