MCPcopy Create free account
hub / github.com/alibaba/bigcomputing / _batch_data

Method _batch_data

DIEN/data_loader.py:79–111  ·  view source on GitHub ↗
(self, data, data_slice)

Source from the content-addressed store, hash-verified

77
78
79 def _batch_data(self, data, data_slice):
80 uid_array,item_array,cate_array,shop_array,node_array,product_array,brand_array,\
81 target, history_item,history_cate,history_shop, history_node,history_product,history_brand,\
82 neg_history_item,neg_history_cate,neg_history_shop, neg_history_node,neg_history_product,neg_history_brand = data
83 #print("in _batch_data func")
84 user_id = uid_array[data_slice]
85 item_id = item_array[data_slice]
86 cate_id = cate_array[data_slice]
87 shop_id = shop_array[data_slice]
88 node_id = node_array[data_slice]
89 product_id = product_array[data_slice]
90 brand_id = brand_array[data_slice]
91 label = target[data_slice, :]
92 hist_item = history_item[data_slice, :]
93 hist_cate = history_cate[data_slice, :]
94 hist_shop = history_shop[data_slice, :]
95 hist_node = history_node[data_slice, :]
96 hist_product = history_product[data_slice, :]
97 hist_brand = history_brand[data_slice, :]
98
99 hist_mask = np.greater( hist_item, 0) * 1.0
100
101 neg_hist_item = neg_history_item[data_slice, :]
102 neg_hist_cate = neg_history_cate[data_slice, :]
103 neg_hist_shop = neg_history_shop[data_slice, :]
104 neg_hist_node = neg_history_node[data_slice, :]
105 neg_hist_product = neg_history_product[data_slice, :]
106 neg_hist_brand = neg_history_brand[data_slice, :]
107
108 return [user_id, item_id, cate_id,shop_id, node_id, product_id, brand_id,
109 label, hist_item, hist_cate, hist_shop, hist_node, hist_product, hist_brand,
110 hist_mask, neg_hist_item, neg_hist_cate, neg_hist_shop, neg_hist_node,
111 neg_hist_product, neg_hist_brand ]
112
113 def next(self):
114 previous_data_out = []

Callers 1

nextMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected