|
|
@@ -83,10 +83,34 @@ def run():
|
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- generate_features_shap("00000000000000000000000011445301", "350139", delivery_count=5000)
|
|
|
+ # generate_features_shap("00000000000000000000000011445301", "420202", delivery_count=5000)
|
|
|
# recommend_list = get_recommend_list("00000000000000000000000011445301", "420202")
|
|
|
# recommend_list = pd.DataFrame(recommend_list)
|
|
|
# recommend_list.to_csv("./data/recommend_list.csv", index=False, encoding="utf-8-sig")
|
|
|
- # data = dao.get_order_by_cust("00000000000000000000000011445301", "445381107139")
|
|
|
+
|
|
|
+ # 拿龙军数据
|
|
|
+ # data = dao.get_order_by_cust("00000000000000000000000011445301", "445323105795")
|
|
|
# data = data.groupby(["cust_code", "product_code", "product_name"], as_index=False)["sale_qty"].sum()
|
|
|
- # data.to_csv("./data/cust.csv", index=False)
|
|
|
+ # data.to_csv("./data/cust.csv", index=False)
|
|
|
+
|
|
|
+ city_uuid = "00000000000000000000000011445301"
|
|
|
+ order_data = dao.get_order_by_cust("00000000000000000000000011445301", "445323105795")
|
|
|
+ order_data["sale_qty"] = order_data["sale_qty"].fillna(0)
|
|
|
+ order_data = order_data.infer_objects(copy=False)
|
|
|
+ order_data = order_data.groupby(["cust_code", "product_code", "product_name"], as_index=False)["sale_qty"].sum()
|
|
|
+
|
|
|
+ cust_data = dao.load_cust_data(city_uuid)[CustConfig.FEATURE_COLUMNS]
|
|
|
+ sample_data_clear(cust_data, CustConfig)
|
|
|
+ shop_data = dao.load_shopping_data(city_uuid)[ShopConfig.FEATURE_COLUMNS]
|
|
|
+ sample_data_clear(shop_data, ShopConfig)
|
|
|
+ cust_ids = shop_data.set_index("cust_code")
|
|
|
+ cust_data = cust_data.join(cust_ids, on="BB_RETAIL_CUSTOMER_CODE", how="inner")
|
|
|
+
|
|
|
+ product_data = dao.load_product_data(city_uuid)[ProductConfig.FEATURE_COLUMNS]
|
|
|
+ sample_data_clear(product_data, ProductConfig)
|
|
|
+
|
|
|
+ order_data = order_data.merge(product_data, on="product_code", how="inner")
|
|
|
+ order_data = order_data.merge(cust_data, left_on='cust_code', right_on='BB_RETAIL_CUSTOMER_CODE', how="inner")
|
|
|
+
|
|
|
+ result = gbdtlr_model.inference_from_sample(order_data)
|
|
|
+ result.to_csv("./data/junlong.csv", index=False)
|