perf: filter scan optimization and portfolio selection improvements
Precompute p_ball to speed up exhaustive filtering, add fixed-ball validation with labeled exceptions, and improve portfolio selection via ymd-seeded shuffle and coverage-aware tie-breaking. Include lotto draw 1225 history update. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3812,9 +3812,10 @@ class BallFilter:
|
||||
if len(set_ball & {3, 20, 44}) == 3: return 2928
|
||||
return None
|
||||
|
||||
def extract_final_candidates(self, ball, no=None, until_end=False, df=None):
|
||||
p_ball = df[df['no'] == no - 1].values.tolist()[0]
|
||||
p_ball = p_ball[1:7]
|
||||
def extract_final_candidates(self, ball, no=None, until_end=False, df=None, p_ball=None):
|
||||
if p_ball is None:
|
||||
p_ball = df[df['no'] == no - 1].values.tolist()[0]
|
||||
p_ball = p_ball[1:7]
|
||||
|
||||
filter_set = set()
|
||||
|
||||
@@ -4447,7 +4448,9 @@ class BallFilter:
|
||||
|
||||
return filter_set
|
||||
|
||||
def filter(self, ball, no, until_end=False, df=None, filter_ball=None):
|
||||
filter_type = self.extract_final_candidates(ball=ball, no=no, until_end=until_end, df=df)
|
||||
def filter(self, ball, no, until_end=False, df=None, filter_ball=None, p_ball=None):
|
||||
filter_type = self.extract_final_candidates(
|
||||
ball=ball, no=no, until_end=until_end, df=df, p_ball=p_ball
|
||||
)
|
||||
|
||||
return filter_type
|
||||
Reference in New Issue
Block a user