hypersoniq's Blog

Just figured out how to add weight to the follower data!

So, we have a list that captures ALL follower data for the last drawn number in each position from 7 different vantage points. Then I added the most recent followers that auto range based on their last number drawn. So here is how the weighting will work...

1. Keep the full combined list of follower data

2. ADD to it the combined recent data lists, this adding weight to the recent followers.

Step 2 acts like a theta weight in linear algebra, as it makes recent followers a "feature", and then the theta is what gets changed to fine tune the overall data.

Maybe it works, maybe it does not. It is adding 36 lines of code to a 2,200+ line script and editing another 36 lines of code, so not that bad of a project. The bottom line is getting back to just one pick per game for the games it supports.

I have no idea how many recent picks are the right amount to add weight, perhaps a percentage of the follower count or the draw history length? 

It must be narrowed down to just one before back testing can be coded, so hopefully there is a glimmer of hope in this new modification.

Entry #228

Coding is complete, now the big decision... which version?

The code that takes a pick from the entire 7 sets of follower history is complete.

Which leaves me with a choice...

1. Keep the short term lists with the most recent data or

2. Keep the long term lists with all of the data.

The biggest positive to using the full data set is that there is zero seasonality to lottery histories.

The biggest drawback is that the MOST of something actually rarely happens.

The biggest positive to the short term recent system is that it runs faster.

The biggest negative... it keeps failing tests.

Since this was originally coded for the dailies like pick 3, that may yield the best testing ground... play both for a week n pick 3 and see what gets closest.

Test starts tomorrow...

Entry #227

Why followers? And an idea for the next script change

When I look at the many ways in the forums to pick lottery numbers, I try to keep in mind what we have available to us. With the draw history, we have the follower data at hand (except for the next draw, of course). The basic premise... (using pick 3 as an example) if they drew a 6 in position 1 last night, I can look to see what followed a 6 in position 1 all through the history. There results a distribution that is about as uniform as raw draw data, but there is one number that has followed the MOST.

So what we are gathering is the MOST FREQUENT follower of the last number drawn.

Doing this manually takes too much time. Doing this with Excel is a clunky process as well, usually involving filtering and conditional formatting. Using a python script to read from a comma separated value file (csv) can perform the same task in about 1 second.

My other hypothesis is that using different follower scenarios together might add weight to the overall pick. So I use direct followers, aka skip1. Also skip2, skip3, skip7, skip14, skip21 and skip28. Why? Imagine a camera at a stop sign where there was an incident. One camera angle can tell a part of the story, but 7 cameras all at different angles paint a more accurate picture of what happened.

My initial code looks at only the most recent followers in each category, but that is where I probably went wrong... I am reading the last chapter of a long book... 

The next iteration of the script will gather ALL follower data from each skip scenario, roll them into a huge list, and make it's pick by using the statistical MODE (as it does now with partial lists) on ALL of the data, ALL at once!

I realize that all numbers have the possibility of following, and that the MOST of something only appears SOME of the time, but I am at a loss for other ideas at the moment.

Although I enjoy writing scripts in Python, I know I am still a novice coder, so a change of that magnitude will take some time to get right. Time I am willing to invest. This behemoth of a script is already 2,200 lines long, and that is with following software engineering best practices like modularity.

It may not be a breakthrough in cranking out straight hits, but it will be the cheapest "system" to play as it only draws one pick, and I feel that based on my limited knowledge of both lottery systems and coding, and my biases about lottery data (the pick 3 is 3 sequential games of 1 in 10, position A has no influence on positions B or C)  this does represent my Best guess.

After this update, I will start making improvements on the visuals, maybe a GUI interface, and I am already working on parsing the PA lottery RSS feed (since they don't provide an api) to make updating the draw history files easier and faster. I can update ALL draw files and generate picks in about 10 minutes. I might consider adding PACash5, Treasure Hunt, Pick2 and PACash4Life, but only if the RSS feed parser script works out.

Anyone else experimenting with Python or another programming language for the purpose of lottery picks?

Entry #226

Test # 2, The Jackpot Games (PB & MM)

The next round of testing will begin Monday (9/11) with the Power ball and end on Saturday(9/16), also with the power ball.

There are actually 3 games involved, the Mega Millions, The Power ball, and PA's Power Ball Double Play (a separate game with a separate draw history, also a different prize payout... no multiplier and top prize always $10M)

Since you MUST enter a draw into the main PB game, there will be 2 picks for each powerball draw. Adding the multiplier and double draw entry fee, that means both picks are eligible for prizes in both games. For the purpose of this test, results will be separated, so the first line only counts for the main game, and the second only counts for the double draw. Any coincidental payouts won't count.

2 tickets loaded with options for the power ball is a cost of $8

The Mega Millions with the megaplier is a cost of $3

Total System Test Cost = $30 across 3 PB and 2 MM draws. Test duration = 6 days. Pick Method = My Super Seven Python follower script described in detail in earlier blog posts.

The Goal = A hit or combination of hits that exceed the test cost of $30. 

The expectation... it is all coincidental anyway, the realistic expectation is that I donate $30 to "Older Pennsylvanians"

Unlike the last test, this only has to work once!

Entry #225

Follower category weights

The script I wrote generates 2 distinct categories of data.

1.full count of follower data over the entire game history. Presented as a ranked count, most occurrences to least.

2. The most recent lists, which vary based on the last draw (if a 5 came up in that position last, then the next list length will be 5.)

I am wondering if maybe there is a way to weight the recent list numbers with the full list count results.

The data for the short lists is combined to get the pick. I could also print the individual scenario picks (skip 1, skip 2, skip 3, skip 7, skip 14, skip 21 and skip 28), but to what end?

I have also thought about adding 2 new perspectives... skip 182 and skip 364. Not sure if they will help.

It all comes down to the pick, I am sure I could do more, but what?

Entry #224

Half way through the 4 day test.

The first 2 days of testing on the PA pick 3/4/5 (mid and eve) and the Match 6 are done.

Cost to date: $20

Wins to date: $2 on Match 6 on the first day.

Net result: -$18

Observations:

1. The picks have numbers in position and out of position (so the box has been close a few times, a worthwhile add)

2.  Even with manual updates to all 7 history files, the picks can be obtained in about 15 minutes, which makes this one of the fastest workflows of any system I have developed.

3. The pick 3 is the most wildly variant, sometimes the pick has no matches.

4. The pick 5 has consistently had 2 or 3 numbers match, though not all in position.

 

So, midway through it is still, like all other systems, coincidental. Post test, cycling the p3 p4 and p5 would be even cheaper to run.

Because it is coincidental, there is no need to go through the hassle of rushing the back test script, the value there is in just making it work. Still going to create it, I just feel the results will not be as important as I thought it might.

Onward to day 3...

Entry #223

Why does Mr. "One line" play 2 lines on PowerBall?

The main focus of every system that I have developed (and subsequently abandoned) was always one single bet.

For pick 3/4/5 just one play each

For Mega Millions and Match 6, just one line

Power ball in PA presents a unique case. My pick for the PB is based only on the dataset of results for the current matrix. PA also offers Double Play. I pick that line based solely on the double draw results dataset. BUT... you can't just enter the double draw, you need to enter the main draw and pay an extra $1 to get in the double draw.

Therefore power ball is my only exception to the "one line per game" goal I have set. Though technically it is one line per game, the requirement is to play for both games.

Entry #222

The next steps for my Python follower system script...

Since the core logic is tested and functioning,time to consider the next steps...

1. Create a desktop application around the script. This will be valuable practice for user interface/ user experience (UI/UX). Using the PA lottery ball images instead of text output would be both easier to read (totally a thing for us older folks) and visually appealing.

2. Add an update the draws option. While it would be nice for the PA lottery to have an API, they sadly do not... but they DO have an RSS feed! I will practice parsing this feed, converting the data to a usable form (text to integer for results and text date to date for draw date.) And then having it build an update sequence to append to all of the results history .csv files. Would have allow for updating multiple draws if I miss a day or two.

3. Work in a back test screen.

4. Work in a statistics screen to display the verbose info for each draw, though the main output would be just the picks.

5. Work in a historical function that can show the results of system pick vs actual draw and derive statistics from that info. Maybe an adjustable time frame, such as last week/month/year/custom date range... would basically just let you query the data from the back test.

6. Figure out how to wrap it into an android solution so the entire package can be 100% mobile.

So while waiting for a win, there is still so much to do... free software engineering lab!

Entry #221

Trying this new configuration for PA pick 3 9/2/2023

Here is the output... (5-8-3 mid day and 8-5-0 evening). note how the list lengths equal the last draw result... Auto ranging! Now let's see if it might work...

===================================================================================
Pick 3 Mid Day Followers
===================================================================================

The number of followers in the RECENT lists: 5, total followers evaluated: 35
Mode of most recent followers sets combined (The pick!) is >>> 5.0 <<<

-------------------------------------------------------------


The number of followers in the RECENT lists: 2, total followers evaluated: 14
Mode of most recent followers sets combined (The pick!) is >>> 8.0 <<<

-------------------------------------------------------------


The number of followers in the RECENT lists: 3, total followers evaluated: 21
Mode of most recent followers sets combined (The pick!) is >>> 3.0 <<<

-------------------------------------------------------------

===================================================================================
Pick 3 Evening Followers
===================================================================================

The number of followers in the RECENT lists: 8, total followers evaluated: 56
Mode of most recent followers sets combined (The pick!) is >>> 8.0 <<<

-------------------------------------------------------------


The number of followers in the RECENT lists: 9, total followers evaluated: 63
Mode of most recent followers sets combined (The pick!) is >>> 5.0 <<<

-------------------------------------------------------------


The number of followers in the RECENT lists: 4, total followers evaluated: 28
Mode of most recent followers sets combined (The pick!) is >>> 0.0 <<<

-------------------------------------------------------------

====================================================================

Entry #220

What did I overlook?

The current follower system has a setting for list length that can be unique to each game, but the same across positions. That is what I overlooked. The ability to set the list length for each position... I will remedy that!

Each position in pick 3 (and beyond) has it's own history, and might give better results if it had it's own list length. I will set up the unique variables to pass these in during the function call as parameters. I will determine in the short term here which lengths to use by solving tonight's draw BEFORE updating the csv draw files. Though it has the potential for over fitting, the limits will be to choose the lowest list length that contains the winning number... even if it was not the one picked. May take longer than one night to implement, but I think it is the next logical step.

I have already started the script that will perform the back test, begun by suppressing the verbose output and limiting it to list length (which will also be suppressed later) and the pick.

Going to try starting at between 2 and 3 years of seed data, for example pick 3 from the start to dec. 31st 1979 and begin that back test from January 1st, 1980, as the past draws are far back enough to allow follower data, and that information would have been a priori.

A statistics based system might not be glamorous or as fun as picking 100 numbers for all states, but if it works at an interval to hit enough to be profitable, then it will be worth the time, and for the jackpot games implementation, that only needs to work once.

Entry #219

Trying to fit the jackpot games (MM and PB) into the new program.

While calibrating the dailies (pick 3, 4 & 5) on paper, I ran the mega millions data for 7 different settings. It picked several mega balls, but the most consistent one was 25, the one drawn last night,  white balls could only manage one. This might not be the tool for the white balls, but it does seem useful in narrowing down a good Mega Ball pick. Testing tonight on the power ball.

I played 7 lines of MM last night (total cost $21, with megaplier) and brought in $42.

Letting that $42 roll with similar test on the power ball tonight. The difference being the cost of the test... as I keep separate data for the power ball double play that they pick in PA. The $42 will require an additional $14. Nothing ventured, nothing gained. The results from last night let me pick a setting for MM and for all of the un-played draw games. The one annoying anomaly... again the mid day winner (straight) was among the evening picks... twice in 2 weeks.

After this test to dial in the power ball, I will have all the list lengths set and go back to 1 pick per draw, no guarantee, but I will honestly be able to say it is my best guess.

Working out the most affordable play strategy, then a proper live test can be conducted (with LP predictions to record progress)

Made a copy of the script to start modifying output for the back test. Not going to be easy, but will be worth the knowledge gained in manipulating 2 CSV files in the same script at the same time.

Entry #218

Time to refocus, tweaking the settings...

The ultimate goal is one pick for one game. There are really 3 parameters I can adjust...

1. The number of recent followers in each list

2. The number of lists

3. The skip length of each list

The day for night thing was an observation when the pick for day came out straight for night, but that adds cost and defeats the original purpose of the system.

The list length is the easiest to adjust. Perhaps the next move should be to try several list lengths at once to see which one got closest to the last draw before updating the databases today. That sounds like the plan. I expect that each game may have it's own list length setting.

Also making a copy of the script, suppressing all output but the picks and getting the new script ready to process the back test.

Entry #217

Edges

One test for the new script is setting the most recent list length to one... accomplishes an expected behavior and a fall back one...

1. Expected behavior is to return the mode, or most frequent of the 7 individual followers.

2. Fallback behavior... if all 7 are different, choose the first follower (the most recent).

No code changes were required, just passing each function the value of 1 for number of followers. It is looking at

Direct follower

Skip 1 follower

Skip 2 follower

Skip 7 follower

Skip 14 follower

Skip 21 follower

Skip 28 follower

So it always has 7 numbers to work with.

Worth a test on tomorrow's PA pick 3...

Mid day best guess... 289

Eve best guess... 965

Based on recent observations, going to play each pick for day and night.

Entry #216

5 out of 6 on the PA Match six last night, but not on the system generated line

Mixed result... system pick was 0 matches, but the last QP line had 5 of 6, and the 6th winning number was above on qp line 2...

So the system did not work for the win, but I would not have played that ticket if I wasn't testing the system.

Total win was $1,025

The other anomaly last night was on the pick 3, the number that my system gave for the mid day came out straight at night... did not play day for night because of the added cost, but I couldn't help but notice that.

Might be worth keeping an eye on for the rest if the week. Playing each pick for both doubles the play cost to $4/day and shortens the profitability window to a win within 125 draws.

Still planning the back test parameters, possibly limiting the starting pool to 3 years as the other games were not around as long as the pick 3.

It did not escape me that I was 1 number away from 1.6 million last night. But since it was on a QP line, it does not give the system development any real motivational boost. That motivation comes from the challenge of applying unit test best practices to the back test phase.

Entry #215

What I look for in a pick 3 back test

It is all about gaps. The gaps between wins.

What you can tell right away...

A maximum gap (longest stretch between wins) of 501 days or more indicates a system that is not profitable.

The average gap has no value.

The minimum gap is the number of days you can confidently STOP playing. If you don't play every draw, your expense in chasing the next win is reduced! If there is an anomaly like a back to back win, it can most likely be discounted as an outlier. By looking at the gap data, there is a statistics formula to determine outliers.

So the use is...

Max gap determines profitability... is the system worth pursuing?

The min gap determines when to NOT play to save on the play budget.

I am still on the part of my system where I can get picks, but have not finished the back test yet. I may play on occasion to try and get a win, but I won't have this info immediately. 

There are no guarantees, but this idea helps reduce the play expense, thereby maximizing profitability.

Entry #214