添加python脚本
This commit is contained in:
164
PyModel/batch_predict_betting_v7.py
Normal file
164
PyModel/batch_predict_betting_v7.py
Normal file
@@ -0,0 +1,164 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 如果当前目录不在sys.path中,就添加进去(避免重复添加)
|
||||
if current_dir not in sys.path:
|
||||
sys.path.append(current_dir)
|
||||
|
||||
from predict_model_v6 import LotteryPredictorV6
|
||||
|
||||
|
||||
SUM12_ODDS = {
|
||||
3: 41.9, 4: 41.9, 18: 41.9, 19: 41.9,
|
||||
5: 20.38, 6: 20.38, 16: 20.38, 17: 20.38,
|
||||
7: 13.51, 8: 13.51, 14: 13.51, 15: 13.51,
|
||||
9: 9.7, 10: 9.7, 12: 9.7, 13: 9.7,
|
||||
11: 8.1
|
||||
}
|
||||
# 玩法1.1 赔率映射
|
||||
SIZE_ODDS = {"冠亚大": 2.1, "冠亚小": 1.7}
|
||||
ODD_EVEN_ODDS = {"冠亚单": 1.7, "冠亚双": 2.1}
|
||||
NUM_DETAIL_ODDS = 1.9199 * 20
|
||||
# NUM_DETAIL_ODDS = {"大": 1.9199, "小": 1.9199, "单": 1.9199, "双": 1.9199}
|
||||
# 玩法2.1/2.2/3 固定赔率
|
||||
RANK_GLH_ODDS = 1.9199 * 10 # 玩法2.2
|
||||
NUM_POS_ODDS = 9.599 * 10 # 玩法3
|
||||
|
||||
# 总赔率
|
||||
TOTAL_ODDS = 0
|
||||
SUM12_ODDS_TOTAL = sum(SUM12_ODDS.values())
|
||||
SIZE_ODDS_TOTAL = sum(SIZE_ODDS.values())
|
||||
ODD_EVEN_ODDS_TOTAL = sum(ODD_EVEN_ODDS.values())
|
||||
|
||||
TOTAL_ODDS += SUM12_ODDS_TOTAL + SIZE_ODDS_TOTAL + ODD_EVEN_ODDS_TOTAL
|
||||
TOTAL_ODDS += round(NUM_DETAIL_ODDS + RANK_GLH_ODDS + NUM_POS_ODDS, 4)
|
||||
# TOTAL_ODDS += round(NUM_DETAIL_ODDS * 20 + RANK_GLH_ODDS * 10 + NUM_POS_ODDS * 10, 4)
|
||||
|
||||
EMPTY_TIME_WINDOWS = [
|
||||
"06:05:00", "06:10:00", "06:15:00", "06:20:00", "06:25:00", "06:30:00", "06:35:00", "06:40:00", "06:45:00",
|
||||
"06:50:00", "06:55:00", "07:00:00",
|
||||
]
|
||||
print(f"总赔率: {TOTAL_ODDS}")
|
||||
|
||||
# 生成预测数据
|
||||
def generate_time_series(start_str, end_str):
|
||||
start = datetime.strptime(start_str, '%Y-%m-%d %H:%M:%S')
|
||||
end = datetime.strptime(end_str, '%Y-%m-%d %H:%M:%S')
|
||||
current = start
|
||||
series = []
|
||||
while current <= end:
|
||||
series.append(current)
|
||||
current += timedelta(minutes=5)
|
||||
return series
|
||||
|
||||
def main():
|
||||
predictor = LotteryPredictorV6('data_test_predict/aggregated_stats_v7.json')
|
||||
with open("full_history_time_performance.json", "r", encoding="utf-8") as f:
|
||||
time_windows = json.load(f)
|
||||
|
||||
# start_time = "2025-01-01 07:05:00"
|
||||
# end_time = "2026-01-19 06:00:00"
|
||||
start_time = "2026-01-20 07:05:00"
|
||||
end_time = "2026-01-21 06:00:00"
|
||||
time_series = generate_time_series(start_time, end_time)
|
||||
|
||||
total_budget = 20.0
|
||||
results = []
|
||||
|
||||
for dt in time_series:
|
||||
date_str = dt.strftime('%Y-%m-%d')
|
||||
time_str = dt.strftime('%H:%M:%S')
|
||||
raw = predictor.predict(date_str, time_str)
|
||||
|
||||
# 收集所有潜在押注项及其原始概率
|
||||
candidates = [] # (type, pos/key, sub_key, prob)
|
||||
|
||||
# 1. Result (数字位置) - 每个位置选 Top 3, 门槛 0.11
|
||||
for i in range(10):
|
||||
# if time_str not in EMPTY_TIME_WINDOWS and time_windows["accuracy"][time_str] < 0.6248:
|
||||
# break
|
||||
pos_key = f'pos_{i}'
|
||||
probs = raw['digital_pos'][pos_key]
|
||||
sorted_p = sorted(probs.items(), key=lambda x: x[1], reverse=True)
|
||||
for val, p in sorted_p[:5]:
|
||||
if p >= 0.1055:
|
||||
# if p >= 0.1055:
|
||||
candidates.append(('result', i, val, p))
|
||||
|
||||
# 2. Result Detail (单双大小) - 互斥, 门槛 0.53
|
||||
for i in range(10):
|
||||
pos_key = f'pos_{i}'
|
||||
for cat in ['big_small', 'odd_even']:
|
||||
probs = raw['pos_detail'][pos_key][cat]
|
||||
sorted_p = sorted(probs.items(), key=lambda x: x[1], reverse=True)
|
||||
best_opt, best_p = sorted_p[0]
|
||||
if best_p >= 0.53068:
|
||||
candidates.append(('result_detail', i, best_opt, best_p))
|
||||
|
||||
# 3. Winner - 门槛 0.08
|
||||
for val, p in raw['winner_prob'].items():
|
||||
if p >= 0.08582:
|
||||
candidates.append(('winner', None, val, p))
|
||||
|
||||
# 4. GD1 & GD2 - 互斥, 门槛 0.53
|
||||
for cat in ['direct_gd1', 'direct_gd2']:
|
||||
probs = raw[cat]
|
||||
sorted_p = sorted(probs.items(), key=lambda x: x[1], reverse=True)
|
||||
best_opt, best_p = sorted_p[0]
|
||||
if best_p >= 0.53068:
|
||||
candidates.append(('gd', cat, best_opt, best_p))
|
||||
|
||||
# 5. GLH (龙虎) - 进取型, 无门槛 (取优势方)
|
||||
for i in range(5):
|
||||
pos_key = f'pos_{i}'
|
||||
probs = raw['glh_pos'][pos_key]
|
||||
sorted_p = sorted(probs.items(), key=lambda x: x[1], reverse=True)
|
||||
best_opt, best_p = sorted_p[0]
|
||||
if best_p >= 0.53068:
|
||||
candidates.append(('glh', i, best_opt, best_p))
|
||||
|
||||
# 动态资金分配: 金额 = (概率 / 总概率和) * 500
|
||||
total_prob_sum = sum(c[3] for c in candidates)
|
||||
|
||||
entry = {
|
||||
"id": dt.strftime('%Y%m%d%H%M'),
|
||||
"time": dt.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
"result": {i: {str(n): None for n in range(1, 11)} for i in range(10)},
|
||||
"result_detail": {i: {"单": None, "双": None, "大": None, "小": None} for i in range(10)},
|
||||
"winner": {},
|
||||
"GD1": {"冠亚大": None, "冠亚小": None},
|
||||
"GD2": {"冠亚单": None, "冠亚双": None},
|
||||
"GLH_result": {}
|
||||
}
|
||||
|
||||
if total_prob_sum > 0:
|
||||
for c_type, key, sub_key, prob in candidates:
|
||||
# bet_amount = round((prob / total_prob_sum) * total_budget, 2)
|
||||
if c_type == 'result':
|
||||
# entry['result'][key][sub_key] = 10
|
||||
entry['result'][key][sub_key] = round((NUM_POS_ODDS / TOTAL_ODDS) * total_budget, 2)
|
||||
elif c_type == 'result_detail':
|
||||
entry['result_detail'][key][sub_key] = round((NUM_DETAIL_ODDS / TOTAL_ODDS) * total_budget, 2)
|
||||
elif c_type == 'winner':
|
||||
entry['winner'][sub_key] = round((SUM12_ODDS[int(sub_key)] / TOTAL_ODDS) * total_budget, 2)
|
||||
elif c_type == 'gd':
|
||||
# key is 'direct_gd1' or 'direct_gd2'
|
||||
field = 'GD1' if key == 'direct_gd1' else 'GD2'
|
||||
_odd = SIZE_ODDS_TOTAL if key == 'direct_gd1' else ODD_EVEN_ODDS_TOTAL
|
||||
entry[field][sub_key] = round((_odd / TOTAL_ODDS) * total_budget, 2)
|
||||
elif c_type == 'glh':
|
||||
entry['GLH_result'][f"pos_{key}_{sub_key}"] = round((RANK_GLH_ODDS / TOTAL_ODDS) * total_budget, 2)
|
||||
|
||||
results.append(entry)
|
||||
|
||||
with open('data_test_predict/betting_predictions_final_1_20.json', 'w', encoding='utf-8') as f:
|
||||
# with open('data_test_predict/betting_predictions_final_502.json', 'w', encoding='utf-8') as f:
|
||||
# with open('data_test_predict/betting_predictions_final_501.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(results, f, ensure_ascii=False, indent=2)
|
||||
print(f"Generated {len(results)} predictions.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
143
PyModel/data_test_predict/aggregated_stats_v7.json
Normal file
143
PyModel/data_test_predict/aggregated_stats_v7.json
Normal file
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"by_time": {
|
||||
"00:05:00": {
|
||||
"result_pos_prob": {
|
||||
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
|
||||
},
|
||||
"result_pos_detail_prob": {
|
||||
"pos_0": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_1": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_2": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_3": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_4": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_5": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_6": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_7": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_8": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
},
|
||||
"pos_9": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
}
|
||||
},
|
||||
"winner_prob": {
|
||||
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
|
||||
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
|
||||
},
|
||||
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
|
||||
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
|
||||
"GLH_pos_prob": {
|
||||
"pos_0": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_1": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_2": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_3": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_4": {"龙": 0.5, "虎": 0.5}
|
||||
}
|
||||
}
|
||||
},
|
||||
"by_date": {
|
||||
"1": {
|
||||
"result_pos_prob": {
|
||||
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
|
||||
},
|
||||
"result_pos_detail_prob": {
|
||||
"pos_0": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
}
|
||||
},
|
||||
"winner_prob": {
|
||||
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
|
||||
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
|
||||
},
|
||||
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
|
||||
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
|
||||
"GLH_pos_prob": {
|
||||
"pos_0": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_1": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_2": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_3": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_4": {"龙": 0.5, "虎": 0.5}
|
||||
}
|
||||
}
|
||||
},
|
||||
"by_week": {
|
||||
"0": {
|
||||
"result_pos_prob": {
|
||||
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
|
||||
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
|
||||
},
|
||||
"result_pos_detail_prob": {
|
||||
"pos_0": {
|
||||
"big_small": {"大": 0.5, "小": 0.5},
|
||||
"odd_even": {"单": 0.5, "双": 0.5}
|
||||
}
|
||||
},
|
||||
"winner_prob": {
|
||||
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
|
||||
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
|
||||
},
|
||||
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
|
||||
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
|
||||
"GLH_pos_prob": {
|
||||
"pos_0": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_1": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_2": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_3": {"龙": 0.5, "虎": 0.5},
|
||||
"pos_4": {"龙": 0.5, "虎": 0.5}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2761
PyModel/full_history_time_performance.json
Normal file
2761
PyModel/full_history_time_performance.json
Normal file
File diff suppressed because it is too large
Load Diff
84
PyModel/predict_model_v6.py
Normal file
84
PyModel/predict_model_v6.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
class LotteryPredictorV6:
|
||||
def __init__(self, stats_path):
|
||||
with open(stats_path, 'r', encoding='utf-8') as f:
|
||||
self.stats = json.load(f)
|
||||
# self.result_weights = {'time': 0.83, 'week': 0.14, 'date': 0.03}
|
||||
self.result_weights = {'time': 0.9, 'week': 0.05, 'date': 0.05}
|
||||
self.result_detail_weights = {'time': 0.9, 'week': 0.05, 'date': 0.05}
|
||||
self.winner_weights = {'time': 0.9, 'week': 0.05, 'date': 0.05}
|
||||
self.gd_weights = {'time': 0.9, 'week': 0.05, 'date': 0.05}
|
||||
self.glh_weights = {'time': 0.9, 'week': 0.05, 'date': 0.05}
|
||||
|
||||
def predict(self, date_str, time_str):
|
||||
dt = datetime.strptime(date_str, '%Y-%m-%d')
|
||||
day_of_month = str(dt.day)
|
||||
day_of_week = str(dt.weekday())
|
||||
|
||||
t_stats = self.stats['by_time'].get(time_str, {})
|
||||
d_stats = self.stats['by_date'].get(day_of_month, {})
|
||||
w_stats = self.stats['by_week'].get(day_of_week, {})
|
||||
|
||||
raw_probs = {
|
||||
'digital_pos': {},
|
||||
'pos_detail': {},
|
||||
'winner_prob': {},
|
||||
'direct_gd1': {},
|
||||
'direct_gd2': {},
|
||||
'glh_pos': {}
|
||||
}
|
||||
|
||||
# 1. 数字位置概率
|
||||
for i in range(10):
|
||||
pos_key = f'pos_{i}'
|
||||
combined = {}
|
||||
for val in range(1, 11):
|
||||
v = str(val)
|
||||
p = (t_stats.get('result_pos_prob', {}).get(pos_key, {}).get(v, 0) * self.result_weights['time'] +
|
||||
w_stats.get('result_pos_prob', {}).get(pos_key, {}).get(v, 0) * self.result_weights['week'] +
|
||||
d_stats.get('result_pos_prob', {}).get(pos_key, {}).get(v, 0) * self.result_weights['date'])
|
||||
combined[v] = p
|
||||
raw_probs['digital_pos'][pos_key] = combined
|
||||
|
||||
# 2. 位置详情 (单双大小)
|
||||
for i in range(10):
|
||||
pos_key = f'pos_{i}'
|
||||
raw_probs['pos_detail'][pos_key] = {'big_small': {}, 'odd_even': {}}
|
||||
for cat in ['big_small', 'odd_even']:
|
||||
options = ['大', '小'] if cat == 'big_small' else ['单', '双']
|
||||
for opt in options:
|
||||
p = (t_stats.get('result_pos_detail_prob', {}).get(pos_key, {}).get(cat, {}).get(opt, 0) * self.result_detail_weights['time'] +
|
||||
w_stats.get('result_pos_detail_prob', {}).get(pos_key, {}).get(cat, {}).get(opt, 0) * self.result_detail_weights['week'] +
|
||||
d_stats.get('result_pos_detail_prob', {}).get(pos_key, {}).get(cat, {}).get(opt, 0) * self.result_detail_weights['date'])
|
||||
raw_probs['pos_detail'][pos_key][cat][opt] = p
|
||||
|
||||
# 3. 冠亚和
|
||||
for val in range(3, 20):
|
||||
v = str(val)
|
||||
p = (t_stats.get('winner_prob', {}).get(v, 0) * self.winner_weights['time'] +
|
||||
w_stats.get('winner_prob', {}).get(v, 0) * self.winner_weights['week'] +
|
||||
d_stats.get('winner_prob', {}).get(v, 0) * self.winner_weights['date'])
|
||||
raw_probs['winner_prob'][v] = p
|
||||
|
||||
# 4. GD1 & GD2
|
||||
for cat, opts in [('direct_gd1', ['冠亚大', '冠亚小']), ('direct_gd2', ['冠亚单', '冠亚双'])]:
|
||||
stat_key = 'GD1_prob' if cat == 'direct_gd1' else 'GD2_prob'
|
||||
for opt in opts:
|
||||
p = (t_stats.get(stat_key, {}).get(opt, 0) * self.gd_weights['time'] +
|
||||
w_stats.get(stat_key, {}).get(opt, 0) * self.gd_weights['week'] +
|
||||
d_stats.get(stat_key, {}).get(opt, 0) * self.gd_weights['date'])
|
||||
raw_probs[cat][opt] = p
|
||||
|
||||
# 5. 龙虎
|
||||
for i in range(5):
|
||||
pos_key = f'pos_{i}'
|
||||
raw_probs['glh_pos'][pos_key] = {}
|
||||
for opt in ['龙', '虎']:
|
||||
p = (t_stats.get('GLH_pos_prob', {}).get(pos_key, {}).get(opt, 0) * self.glh_weights['time'] +
|
||||
w_stats.get('GLH_pos_prob', {}).get(pos_key, {}).get(opt, 0) * self.glh_weights['week'] +
|
||||
d_stats.get('GLH_pos_prob', {}).get(pos_key, {}).get(opt, 0) * self.glh_weights['date'])
|
||||
raw_probs['glh_pos'][pos_key][opt] = p
|
||||
|
||||
return raw_probs
|
||||
Reference in New Issue
Block a user