# Machine Learning, PHP and the Lottery

Machine Learning is what it sounds like it is, a machine learning. I have been working with ML and automated software systems for the last few years. It is only recently that the value of machine learning as a predictive tool is becoming apparent. My work has been with numerical data, in particular sports related data and more recently lottery numbers. Before you read more, impossible as it may sound it is possible to predict the pattern of numbers that are drawn in the various lotteries.

## ML and PHP

I work extensively with the PHP ML library. Tests that involve regression analysis; correlations with Pearson’s R, KNN (Nearest Neighbor) and Naïve Bayes. The purpose of these tests has been simply to label an event as either a plus or a negative i.e., winner or loser. Correlation with Pearson’s R is great for identifying the strength of relationships between data sets. For example, in football it is possible to test the strength of relationships between games drawn and goals conceded (for all teams in a particular league). Naïve Bayes tests and KNN take differing amounts of input data. With Naïve Bayes you input three data sets and a predicted outcome, with KNN two data sets and a predicted outcome.

### KNN (Nearest Neighbor)

The Nearest Neighbor test has more flexibility than the Naïve Bayes tests, you can, using PHP ML define the number of nearest neighbours you want identified, which distancing model to use and a lambda value for this distancing model. This is the most time consuming part, the accuracy of the test is dependent on your ability to define the neighbours, select distancing model and define a lambda value. The PHP ML library has four distancing models, distancing is the process of defining the spatial aspect of the predictive KNN tests.

### Distancing Models

Chebyshev, Minkowski, Euclidean and Manhattan are the distancing models available. The Manhattan distancing model I think is derived from the work of Roger Joseph Boscovich in the 18th century. It was Boscovich who discovered the absence of any atmosphere on the moon. Chebyshev distancing was created about the same time by a Russian statistician of the same name. Hermann Minkowski is best known for his work in relatively and a former student of his was Albert Einstein. His work on relativity defines the existence of a fourth dimension where space and time are not separate entities. Euclidean distancing, the distance between objects in terms of space can be traced back to the Sumerian empire, but is more popularly accredited to the Greek philosopher Euclid, for example the phrase to elucidate is quite commonly known.

### Predicting the Lottery

A recent software development using PHP and ML is starting to show results. It also indicates that randomness does not exist and that a fourth dimension of inter-related space and time does exist. Anyway, the PHP program takes all the lottery results since day one for the EuroMillions, Thunderball and UK Lotto draws and assigns them a number relative to the month of the year of the draw and a status of 1 relative to all the other numbers in the draw which have a status of 0. Numerology is also applied to the months of the year to create a second set of data for predictions. Invented by Pythagoras, it is a system of assigning number to the letters of the alphabet.

### The Proof is in the Pudding

It sounds that it is a ludicrous claim that the lotteries themselves can be predicted, however the following images show evidence that the KNN test with a distancing model and a certain lambda value is getting remarkably close to picking the winning numbers in the Thunderball draw. The second of the two images illustrates how predictions with numerology are as valuable as those that do not rely on a numerological system (first image). You will see from these images that the algorithm is accurately picking the pattern of the numbers drawn. This has happened on more than the two occaisions that are illustrated. Algorithm development for the EuroMillions draw and the Lotto is also starting to bear fruit.