Commit 80cae241 authored by 宋柯's avatar 宋柯

模型调试

parent 36edbfb2
......@@ -941,6 +941,10 @@ if __name__ == '__main__':
import tensorflow as tf
def get_example_string(splits):
def fill_null(str):
return '-1' if str is None else str
features = {
'ITEM_CATEGORY_card_id': tf.train.Feature(bytes_list=tf.train.BytesList(value=[splits[0].encode()])),
'USER_CATEGORY_device_id': tf.train.Feature(bytes_list=tf.train.BytesList(value=[splits[2].encode()])),
......@@ -948,13 +952,13 @@ if __name__ == '__main__':
'USER_CATEGORY_user_city_id': tf.train.Feature(
bytes_list=tf.train.BytesList(value=[splits[4].encode()])),
'USER_MULTI_CATEGORY_second_solutions': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[6].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[6]).split(','))))),
'USER_MULTI_CATEGORY_second_demands': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[7].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[7]).split(','))))),
'USER_MULTI_CATEGORY_second_positions': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[8].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[8]).split(','))))),
'USER_MULTI_CATEGORY_projects': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[9].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[9]).split(','))))),
'ITEM_NUMERIC_click_count_sum': tf.train.Feature(
float_list=tf.train.FloatList(value=[float(splits[10])])),
'ITEM_NUMERIC_click_count_avg': tf.train.Feature(
......@@ -988,13 +992,13 @@ if __name__ == '__main__':
'ITEM_CATEGORY_hospital_is_high_quality': tf.train.Feature(
bytes_list=tf.train.BytesList(value=[splits[27].encode()])),
'ITEM_MULTI_CATEGORY_second_demands': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[28].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[28]).split(','))))),
'ITEM_MULTI_CATEGORY_second_solutions': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[29].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[29]).split(','))))),
'ITEM_MULTI_CATEGORY_second_positions': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[30].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[30]).split(','))))),
'ITEM_MULTI_CATEGORY_projects': tf.train.Feature(
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), splits[31].split(','))))),
bytes_list=tf.train.BytesList(value=list(map(lambda s: s.encode(), fill_null(splits[31]).split(','))))),
'ITEM_NUMERIC_sku_price': tf.train.Feature(float_list=tf.train.FloatList(value=[float(splits[32])])),
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=[int(splits[5])])),
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment