소스 검색

调整边界起飞时间(72小时), 发送政策接口增加两个字段

node04 3 주 전
부모
커밋
f88dd4ddbc
4개의 변경된 파일12개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 4
      data_process.py
  2. 5 0
      descending_cabin_task.py
  3. 2 2
      main_pe.py
  4. 1 1
      main_tr.py

+ 4 - 4
data_process.py

@@ -84,7 +84,7 @@ def preprocess_data_simple(df_input, is_train=False, hourly_time=None):
 
     # 训练过程
     if is_train:
-        df_target = df_input[(df_input['hours_until_departure'] >= 24) & (df_input['hours_until_departure'] <= 360)].copy()
+        df_target = df_input[(df_input['hours_until_departure'] >= 72) & (df_input['hours_until_departure'] <= 360)].copy()
         df_target = df_target.sort_values(
             by=['gid', 'baggage_weight', 'hours_until_departure'],
             ascending=[True, True, False]
@@ -190,7 +190,7 @@ def predict_data_simple(df_input, city_pair, object_dir, predict_dir=".", pred_t
     ).reset_index(drop=True)
 
     df_sorted = df_sorted[
-        df_sorted['hours_until_departure'].between(24, 360)
+        df_sorted['hours_until_departure'].between(72, 360)
     ].reset_index(drop=True)
 
     # 每个 gid  baggage_weight 取 hours_until_departure 最小的一条 (当前小时)
@@ -459,12 +459,12 @@ def predict_data_simple(df_input, city_pair, object_dir, predict_dir=".", pred_t
 
     _dep_hour = pd.to_datetime(df_min_hours["from_time"], errors="coerce").dt.floor("h")
     df_min_hours["valid_begin_hour"] = (_dep_hour - pd.to_timedelta(360, unit="h")).dt.strftime("%Y-%m-%d %H:%M:%S")
-    df_min_hours["valid_end_hour"] = (_dep_hour - pd.to_timedelta(24, unit="h")).dt.strftime("%Y-%m-%d %H:%M:%S")
+    df_min_hours["valid_end_hour"] = (_dep_hour - pd.to_timedelta(72, unit="h")).dt.strftime("%Y-%m-%d %H:%M:%S")
 
     # 要展示在预测表里的字段
     order_cols = [
         "citypair", "flight_numbers", "baggage_weight", "from_date", "from_time",
-        "cabins", "ticket_amount", "currency", 
+        "cabins", "ticket_amount", "currency", "price_base", "price_tax",
         "price_total", 'relative_position', 'days_to_departure', 'hours_until_departure', 
         'price_change_amount', 'price_change_percent', 'price_duration_hours', 
         "update_hour", "create_time",

+ 5 - 0
descending_cabin_task.py

@@ -34,6 +34,9 @@ def time_format_conversion(match_time,
 def _process_one_task(row):
     task = row
     
+    price_base = round(float(task.get('price_base', '0.0')))
+    price_tax = round(float(task.get('price_tax', '0.0')))
+
     city_pair = (task.get("citypair") or "").strip()
     if "-" not in city_pair:
         return None
@@ -87,6 +90,8 @@ def _process_one_task(row):
 
     return {
         "trip_type": 1,
+        "cover_price": price_base,
+        "cover_tax": price_tax,
         "bag_amount": pc,
         "bag_weight": kg,
         "max_threshold": max_threshold,

+ 2 - 2
main_pe.py

@@ -33,8 +33,8 @@ def start_predict():
         except Exception as e:
             print(f"remove {csv_path} info: {str(e)}")
 
-    # 预测时间范围,满足起飞时间 在24小时后到360小时后
-    pred_hour_begin = hourly_time + timedelta(hours=24)
+    # 预测时间范围,满足起飞时间 在72小时后到360小时后
+    pred_hour_begin = hourly_time + timedelta(hours=72)
     pred_hour_end = hourly_time + timedelta(hours=360)
 
     pred_date_end = pred_hour_end.strftime("%Y-%m-%d")

+ 1 - 1
main_tr.py

@@ -22,7 +22,7 @@ def start_train():
 
     from_date_end = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")  # 截止日改为昨天
     # from_date_begin = "2026-03-17"  # 2026-03-17 2026-04-15
-    from_date_begin = "2026-04-15"
+    from_date_begin = "2026-03-17"
 
     print(f"训练时间范围: {from_date_begin} 到 {from_date_end}")