Category Archives: Uncategorized

Poisson prediction for soccer match odds

It is the World Cup season. There are many prediction models, and one of the most widely used statistical technique is the Poisson distribution:

soccer-poisson1

The historic match results are available in the public domain, for example, at http://eloratings.net/. The data are analysed to obtain an index referred to attack strength or goal expectancy. This can further elaborates into more complex data like home team and away team expectancy.

soccer-poisson2

By using a matrix of score scales, usually from 0 to 9, all possible outcomes under 10 goals per team are defined with the respective probability. An example matrix with scores from 0 to 2 will look like one below:

soccer-poisson3

This is the basics of predicting soccer in a quantitative way using the Poisson distribution. There are of course many other prediction methods and models, including organic method like asking the famous Paul the octopus 🙂

Advertisements

Exploring optimization problems in Excel

Excel is able to solve optimization problems. Two commonly available tools are the build-in Solver tool and the Excel plugin for Microsoft Solver Foundation (MSF). The former is not installed by default but can be easily enabled through the Excel Options menu. The latter is a separate download available from Microsoft.

For a simple comparison of the performance of the two, the non-linear data fitting example from the MSF is used as benchmark.
msf-1

MSF provided additional menu pane within Excel for complex optimization operations.
msf-2

Optimization results and log of this benchmark run of a non-linear data fitting sample from the MSF, based on an NIST sample.
msf-10
msf-3

Goals setting screen.
msf-5

Model Display.
msf-6

On the other hand, the built-in Solver offered a simpler interface but still provide detailed reports, including answer, sensitivity, and limits reports in separate spreadsheets.
msf-7

msf-8

The built-in Excel Solver offered easy to use interface, while the Microsoft Solver Foundation is more capable for complex problems and modelling.

The NelderMead solver is selected in this benchmark by the MSF. Check out this previous installment for details of running Nelder-Mead on TI Nspire. The same data set is performed on the Nspire using Nelder-Mead to obtain the following results.
msf-9
msf-11

Performance testing the Movidius Neural Compute Stick

The Movidius Neural Compute Stick is great for visual recognition projects with low power consumption and small form factor requirements. A basic introduction is covered in the previous installment, and it is time for a little more field tests on performance.

The first test is calculator, one is Texas Instruments TI84 Plus Pocket SE and the other a Casio fx-4500PA. Both are recognized as hand-held computer with fairly high confidence.movtest1movtest2

Second test is a luxury watch photo, recognized as an analog clock.movtest3

The final test is a feather. At some point the stick returned a 100% confidence. The result is correct.movtest4

This neural computing module did a good job with amazing results as a development kit which is also great for hobby projects. As the technology on hardware AI acceleration matures, we may one day see its integration with CPU to make it ubiquitous product available on the market.

Project in history – Going wireless for a Tamiya kit

This project is completed around 2011. It may look ancient as everyone is crazy about “Drone” today. Nevertheless, it brought me so much fun doing it I am still fond of the good memories today and would like to share here.

The goal back then was simple. A wired Tamiya kit + Arduino + bluetooth + Android phone = Wireless remote controlled bulldozer. Integrate the wireless and accelerometer capability from an Android phone to control this kit. As far as I can recall there was no such term as STEM back then but this sort of project can been seen in those syllabuses today on this exciting subject.

The name Tamiya must ring the bell for everyone who had get their feet wet in the remote control modelling world. Tamiya made great kits at very reasonable price for beginners to moderates. I was lucky enough to own and build one of their classic – a bulldozer kit – many years ago and it remained one of the best part of my memory although that bulldozer itself is nowhere to be seen now.

The below is about pretty much the same kit I came across from Tamiya around 2011 which is Xmas gift from my wife.

The finished mods. It is a Bluetooth enabled Tamiya kit that can be controlled from an Android phone.
395854_333259780020227_713584008_n403063_333259443353594_1805952813_n

The Tamiya kit came with a perfect wired On-Off switches to control the kit for forward-backward-left-right maneuvers.
384643_333179646694907_609266841_n398042_333179746694897_229243479_n

The classic kit I had decades ago (also from Tamiya) is of a wooden base, with metal gears. They are now replaced as plastic that are easier to work with but honestly I still missed the wood and metal. By the way, no power drill is needed for the classic kit with wood, I built mine comfortably with screwdriver and brute force.384637_333179810028224_1549591974_n395470_333179900028215_716701980_n

The core that made it possible from wired to wireless is an Arduino Mega board. Mounted with ease to the baseboard (white) on the Tamiya kit.
401128_333180170028188_114583678_n
388536_333180280028177_623687134_n

The Communication module is an HC-05 Bluetooth board alongside with the H-bride (SN754410) on an Arduino compatible extension board. The design was pretty standard to divide the control circuit from the power circuit that have to drive two 3V motors with power requirements the Arduino board cannot handle.376070_333180030028202_823667822_n

395873_333180076694864_1773154218_n

Prototype in testing.
384074_333179570028248_2022204756_n

A variation configuration using a mobile phone mounted on the kit and via WIFI to stream the real-time video, and have the control of the kit via Bluetooth from the viewing PC. It is a very popular mods back then and the experience of controlling a MARS Rover at home is simply fantastic.
CIMG0592CIMG0589CIMG0590CIMG0588

Visualizing WordPress stats with Excel Power Map

Power Map is a feature available in recent release of Microsoft Excel providing easy to use visualization of data in geographical form as well as temporal animation.

In a sample usage to understand where the readers of this blog are from this year, the WordPress stats data from 2016 are imported into Excel Power Map. WordPress already offered graphical presentation of visitor origin in a nice world map. For animating the data through a whole year by month, Excel Power Map is a nice and easy to use tool with just a little bit more effort to create such animation.

The statistic page should be familiar to all WordPress user. Download the data for each month as CSV and store on local drive.
powermap0

Now prepare the data by consolidating them all in a single Excel worksheet. I used the good ole awk as the source files are in plain text CSV to save some copy and paste efforts. For the animation to work, a new column indicating the time of data (e.g. data for USA in January 2016) has to be added for the Power Map to handle temporal attribute, and this column can not be in formula form.
powermap1a

When the source data are ready, select the whole region and click the 3D Map button under the Insert menu.
powermap2a

Now the Power Map UI will be displayed. A globe map will be displayed by default but since I preferred a flat map form instead of 3D so I clicked on the Flat Map button.
powermap3

The Power Map user interface works pretty much like a pivot table. You drop the dimension on the pre-defined attribute settings pane on the right hand side to tell Power Map how you would like the map to present your data. To create animation, just drag the date column to the “Time” section as the attribute and Power Map will be able to render accordingly.
powermap4

Now that everything is ready, the animation play nicely and Power Map will also be able to create the animation file.powermap5