This repository is built for predicting lottery number.This project predicting number based on an algorithm called temperature-balanced algorithm
Game Rules:
- Game Overview (游戏概览) Players select numbers for two distinct pools: the Red Balls and the Blue Ball.
- Number Selection (选号规则) Red Balls: Choose 6 numbers from a pool of 33 (numbered 1 to 33). Blue Ball: Choose 1 number from a pool of 16 (numbered 1 to 16). A standard single bet consists of 6 red numbers and 1 blue number.
- Drawing Process (开奖过程) During the draw, 6 winning Red Balls and 1 winning Blue Ball are randomly selected from their respective pools.
- Winning Tiers (中奖规则) Prizes are awarded based on how many numbers on your ticket match the drawn numbers. There are typically 6 prize tiers: 1st Prize (Jackpot): Match all 6 Red Balls + the 1 Blue Ball. 2nd Prize: Match all 6 Red Balls (Blue Ball does not match). 3rd Prize: Match 5 Red Balls + the 1 Blue Ball. 4th Prize: Match 5 Red Balls (Blue Ball does not match) OR Match 4 Red Balls + the 1 Blue Ball. 5th Prize: Match 4 Red Balls (Blue Ball does not match) OR Match 3 Red Balls + the 1 Blue Ball. 6th Prize: Match the 1 Blue Ball only (regardless of red balls matched, though typically 0-2 red balls). This is often a fixed small cash prize (e.g., 5 RMB).
- Draw Schedule (开奖时间) Draws are typically held three times a week: on Tuesdays, Thursdays, and Sundays.
- Jackpot Rollover (奖池累积) If no one wins the 1st Prize, the jackpot amount rolls over to the next draw, accumulating until it is won.
#temperature_predictor.py This file contians that called temperature-balanced algorithm.Next i will introduce its basic login.
Double Strategy: Hot Strategy + Cold Strategy Hot Strategy: Divided into short-term, medium-term, and long-term strategies. Cold Strategy: Selecting numbers that people are subconsciously unwilling to choose, infrequently chosen numbers, or numbers with low selection probability. Overall, a voting system is adopted for short-term, medium-term, and long-term strategies. Total votes: 100. Red Ball Strategy Short-term Strategy: Divided into 12 periods for learning. EMMA (0.3) + Heat Trend (0.4) + Position Frequency (0.3) Medium-term Strategy: Divided into 36 periods for learning. Markov Chain (0.6) + Interval Analysis (0.4) Long-term Strategy: Divided into 144 periods for learning. Fourier Transform (0.5) + Monte Carlo (0.5) Multi-period Weighted Fusion: Prediction Score = Short-term * w1 + Medium-term * w2 + Long-term * w3 Weights: w1 = 0.5, w2 = 0.3, w3 = 0.2 Blue Ball Strategy Short-term Strategy: Divided into 12 periods for learning. EMMA (0.4) + Heat Trend (0.6) Medium-term Strategy: Divided into 36 periods for learning. Fourier Transform (0.6) + Interval Analysis (0.4) Multi-period Weighted Fusion: Prediction Score = Short-term * w1 + Medium-term * w2 Weights: w1 = 0.6, w2 = 0.4 Introduction: How to make weights adaptive Combining the aforementioned voting system and weights, this represents 50 votes for the short-term strategy, 30 votes for the medium-term strategy, and 20 votes for the short-term strategy [sic]. Continuing the subdivision: EMMA has 15 votes, Heat Trend has 20 votes, Position Frequency has 15 votes, Markov Chain has 18 votes, Interval Analysis has 12 votes, Fourier Transform has 10 votes, and Monte Carlo has 10 votes. Each method can cast votes for 8 red numbers. The maximum votes a number can receive is the total votes of that method divided by 6, rounded down. After each method votes, the 8 numbers with the highest votes are selected. Then, 6 numbers are chosen from these 8 to form combinations (different orders but same combination of numbers count as one group). These combinations are printed in a human-readable format and recorded in a JSON file. At the same time, the JSON file records the vote count of all predicted numbers, sorted in descending order. After conducting an experiment, observation of the results revealed that the numbers predicted using the Cold Strategy hit 3, while the numbers predicted using the Hot Strategy hit 1. After analysis and reflection, for each draw, we should adopt both the numbers predicted by the Hot Strategy and the numbers predicted by the Cold Strategy, and adjust the Hot and Cold Strategies to an appropriate degree. To create an adaptive number predictor with cold/hot degrees, we need to establish an algorithm to measure the cold/hot degree of numbers. We have now established an algorithm to measure the cold/hot degree of numbers, which involves subtracting the median of the votes from the votes of each number to obtain a "temperature score" for each number. Using a window of 24 periods, the 24 periods prior to the one being predicted are used as historical data to plot a line chart. The purpose of this step is to transform the responsibility of predicting numbers into predicting temperature scores, thereby reducing complexity and increasing predictability. The predicted temperature score for the next period has a range. Through backtesting on historical data, it was found that the range is basically between [-7, 7], so this interval is selected. Meanwhile, to adapt to the temperature span of the data itself for each period, we take the intersection of the temperature range of each period itself with [-7, 7]. Next, we need to consider the prediction of blue balls and how to use the prize money for reinvestment. The previous idea was to convert the 6 balls into a unified score, such as the temperature score mentioned earlier. However, with this method, normal prediction and extreme cold prediction can generally only retrieve balls with high heat or low heat in one way, and cannot retrieve them together. Now the thinking has shifted. We still use temperature scores, but instead of unifying them into one category, we divide them into three categories: Hot Balls (high temperature balls), Warm Balls (balls with neither high nor low temperature), and Cold Balls (low temperature balls). That is, changing from the original form of t = kx + b to t = kx + ly + mz + b, where k, l, m are slopes, x, y, z are variables, and b is the value when x, y, z are all 0.
The result of temperature-balanced algorithm is not good.It can just guess 2 red ball precisely in most situations.And It suits the extrme circumastance which means temperature very high or low.
I will update some information later.