Monday, 18 November 2019

Web Analytics: Requirements Gathering

Everybody knows why your company has a website, and everybody tracks the site's KPIs.

Except that this a modern retelling of the story of three blind men who tried to describe an elephant by touch alone, and everyone has a limited and specific view of your website.  Are you tracking orders? Are you tracking revenue? Are you tracking traffic? Organic? Paid? Banner? Affiliate? Or, dare I ask, are you just tracking hits?

This siloed approach can actually work, with each person - or more likely, each team - working towards a larger common goal which can be connected to one of the site's actual KPIs.  After all, more traffic should lead to more orders, in theory.  The real problem arises when people from one team start talking to another about the success of a joint project.  Suddenly, we have an unexpected culture clash and two teams, working within the same business, are speaking virtually different languages.  The words are the same, but the definitions are different, and while everybody is using the same words, they're actually discussing very different concepts.

At this stage, it becomes essential to take a step back and take time to understand what everyone means when they use phrases like,  "KPIs","success metrics", or even "conversion". I mean, everyone knows there's one agreed definition of conversion, right? No?  Add to cart; complete order; complete a quote, or a lead-generation activity - I have seen and heard all of these called 'conversion'.

When it comes to testing, this situation can become amplified, as recipes are typically being proposed or supported by different teams with different aims.  One team's KPIs may be very different from another's.  As the testing lead, it's your responsibility to determine what the aims of the test are, and from them - and nothing else - what the KPIs are.  Yes, you can have more than one KPI, but you must then determine which KPI is actually the most important (or dare I say, "key"), and negotiate these with your stakeholders.

A range of my previous pieces of advice on testing become more critical here, as you'll need to ensure that your test recipes really do test your hypothesis, and that the metrics will test the hypothesis.  And, to avoid any doubt, make sure you actually define your success criteria in terms of basic metrics (visits, visitors, orders, revenue, page views, file downloads), so that everybody is on the same page (literally and metaphorically).

Keep everybody updated on your plans, and keep asking the obvious questions - assume as little as possible and make sure you gather all your stakeholders' ideas and requirements.  What do you want to test? Why? What do you want to measure? Why?

Yes, you might sound like an insistent three-year-old, but it will be worth it in the end!

Monday, 21 October 2019

How to Solve Edge Matching Cards Puzzles - Practical Advice

While I was at high school, around 25 years ago, I was first introduced to an edge-matching puzzle.  This is made up of 16 square card pieces, with a colour on each edge, that have to be arranged into a 4x4 square so that all the colours of the edges on each piece matches their adjacent neighbour.

It all sounds so easy.

I recently acquired two versions of this edge-matching puzzle - one based on cogs, and one based on footballers - with a view to finally solving it.  I didn't solve the puzzle while I was at school, and I've not revisited it much since, except to conclude that it was impossible, or was going to take longer to solve than I wanted to invest in it.  Well, things have changed, and as it's clearly been pestering me for 20+ years, so I figure it's time to rise to the challenge - especially since the Special Educational Needs Co-ordinator at my high school took delight in telling me that one of the 'weaker' children in our year group had successfully solved it.  Challenge accepted, Mrs Kirkham!

Here, for reference, are the 16 cards in the "Mechanical Mayhem Puzzle":

My first few attempts at the puzzle were not at all successful.  I very quickly connected a few pieces, but never made significant progress, and never really got past about 75% complete  before the pieces refused to go together any more.  I therefore decided it was time to get some hints and help, from that reliable source of all knowledge - the internet.

The most helpful information I found was from a research paper into edge-matching puzzles - apparently, these puzzles are not trivial, in fact they are N-difficult.  The advice was to find matching pairs, and then try to connect pairs to form fours, sixes and eights.  The pairs didn't always form squares, but at least I was now working systematically.  Here are a few candidate pairs, as examples:

And then some candidate squares:

As I became more familiar with the cards, I quickly identified patterns that would not work - for example there are only two squares which contain the bronze-coloured cog shown on the right.  Therefore they must form a pair, since the likelihood of them both being on the outside edge of the 4x4 square seemed low to me.  I didn't count each kind of cog and work out which were the most and least frequent, but I soon noticed that the large golden cog was very common, as was the yellow daisy-style cog.  The very small silvery cog was quite rare, so I was more careful with how I placed any cards that contained it.

And, with a little trial and error, this approach worked for me (with some adjustments, intuition and observation).  You can see from my final solution that the key pair of bronze coloured cogs are in the top-left corner, and yes, I conquered the edge-matching puzzle (and it only took me 20+ years).

Sunday, 20 October 2019

Transformers Trading Card Game: Applied Probability

I've mentioned previously that I have an interest in the Transformers Trading Card Game.

It works like this:  you select a number of character cards, each with specific abilities.  You also compile a deck of 'battle' cards - at least 40, but with no upper limit - that you use to form your hand and the cards that you play in conjunction with your character cards.

Much of the skill in the game comes in deciding which characters to play together as your team, and then in deciding which battle cards you put into your deck.  The battle cards can provide weapons upgrades, armour or utilities, or they can be actions that you play to benefit your team (or to damage your opponent's team).  Each battle card can have between 0-3 coloured icons on them, which has a specific effect on your character's performance when you battle your opponent.  There are orange icons (good for attacking), blue icons (good for defending), white (lets you play more cards while battling), green icons (separate effect on the cards in your hand) and black icons (also good for attacking).

Before you play the game, you have to decide which cards you want to play, and what mix of coloured icons you want to have in your deck.  All orange is all-out attack; all blue is all-out defence; and so on.  But this is where it gets interesting:  some of your characters' special abilities rely on you getting white icons, or orange icons, or even a mix.  One of the character cards I'm working on at the moment is Mirage.  He has an ability where he can 'untap' if you can draw three white icons while he's attacking.  If you draw one white icon while attacking, then you draw two more cards - and hence have the possibility of getting more white cards, if you have a good proportion of white icon cards in your deck.  (There are other ways of drawing more cards while you attack, but that gets very complicated).

And the second - in a different team - is Grapple.  If you can flip a specific combination of cards while he's battling, you get a significant boost to your attack or defensive ability.  You can double his attack rating from 4 to 8, and improve his defence rating from 0 to 4 if you can flip cards which have EXACTLY four different coloured icons.  Duplicated icons are allowed - so flipping one white, one orange, two blue and two green is a success.  Three different colours don't count, and neither do five (if you drew a black, orange, yellow, white and green).

There is an additional property of the cards that we can use - some cards have two different coloured icons on them... white and green; green and blue; green and orange.  There are a strictly limited number of card which have three icons - typically white, orange and blue.  So the probability of hitting a successful flip are increased if I use these cards in my deck.  Computron's Lab have carried out some extensive quantitative research on the ideal deck for Grapple, which is composed entirely of blue-black and white-green, explaining that this gives the highest likelihood of drawing cards to enable Grapple's skill.  I've taken a slightly different approach:


Grapple - 12 stars

Private Red Alert - 7 stars
Silverbolt - 5 stars

(Red Alert and Silverbolt have similar benefits to Grapple - they both activate their skills when you flip at least one white, orange and blue icon when battling).

Extra Padding:  two icon colours and Tough 1.
What's not to like?
Blue-Green = 4
Extra Padding x3
Dismantling Claw x1 (may remove this in future)

White-Green = 9
Secret Dealings x3
Spare Parts x3
Personal Targeting Drone x3

White = 6
Data Pad x3
Spinner Rims x3

Blue = 8Evasive Maneuvers x2
Inspiring Leadership x3
Reinforced Plating x3

Orange = 15
Flamethrower x3

Incoming Transmission x3
Body Armour x3
Treasure Hunt x3
Supercharge x3

Orange-White-Blue (although this a 'star card') = 1
Fuel Depot

Total 42

Orange: 16; Blue 13; White 16; Green 13  Total 48

The selection is almost certainly not the optimum in terms of drawing one of each of the four colours.  However, there is more than just the coloured icons to consider - some of the cards can be played to enable you to draw more cards in your turn.  The game calls this "Bold" when you're attacking, and "Tough" when you're defending.
Bold 3? Yes, please!

Flamethrower - Bold 2
Supercharge - Bold 3
Spinner Rims - Bold 1

Extra Padding - Tough 1
Evasive Maneuvers - Tough 3

Additionally, I have over-indexed on white icons, because if you can draw a card with a white icon, you get to draw two extra cards for that battle (only applies to the first white icon you draw per battle) - and I want to be as confident as possible of hitting a white icon each time.  In total, 16 of the 42 cards have a white icon; ideally I should probably have half of the cards with a white icon, to give me a higher chance of hitting one white icon in every two cards I draw.

In simulations with Bold 0 or Tough 0 (where I drew two cards - plus the two more if I flipped a white), I achieved success in almost a quarter of the draws (6/26).  When I gave myself Bold 1, drawing one extra card, I saw surprisingly little difference - a smaller sample size saw me achieve success on 2 out of 10 occasions.  I shall continue optimizing through empirical data - and because I like the idea of going 'full rainbow.  The research continues.

Thursday, 10 October 2019

"A Puzzle A Day" - Sum of three numbers equals their product

Puzzle 84:
Mr Puzzle says there is only one unique set of three numbers whose total (added together) is equal to their product (multiplied together).  What is it?

This puzzle reminds me of the recent question - "What three numbers satisfy 1/a + 1/b + 1/c = 1?", where the answer was 1/2 + 1/3 + 1/6 = 1.  

The answer to a + b + c = abc can be found if you know that 6 is a 'magic' number - the sum of its factors is equal to their product.

The factors of 6 are 1, 2 and 3:   1 + 2 + 3 =  6 = 1 * 2 * 3

6 is a perfect number  - it's equal to the sum of its divisors (except itself).  Another example is 28 (1 + 2 + 4 + 7 + 14); there are plenty more perfect numbers, and they are extremely large.

6, also is a magic number - it's equal to the product of its divisors (again, except itself).  I can't find any other examples - I guess 6 is unique.  Well, that's what Mr Puzzle said, anyway.

Monday, 16 September 2019

Port Vale 1 Cambridge Utd 0

At the end of the last school year, our family was fortunate enough to win a pair of tickets (one adult and one child) to any one Port Vale home match of the 2019-2020 season. My wife has zero interest in football (possibly even less than that), and one of my children loves football, one has no interest and one is too young to appreciate it. So Lizzie and I won by default, and I opted for the home game against Cambridge United on Saturday 31 August.
This, like my report from Port Vale vs Stevenage from a few years ago (February 2011!), is more of an eyewitness report than match analysis.

The game started brightly under blue, cloudy skies. Vale had some very early chances and most of the early pressure.  The team played well and the majority of the first 45 minutes was played in Cambridge's half.  I don't recall Cambridge having any first-half chances, and it was mostly one-way traffic.

A couple of rare attacks along Cambridge's right wing were stopped by some strong physical defending, as the Vale left back and centre back were pushed, pulled back and occasionally got into a tussle with shirts being pulled and so on.

Nathan Smith (left) keeps an eye on Sam Smith (centre)
There was a period in the first half where the game threatened to boil over, and here I must blame the referee, who (in my own unqualified opinion) had a poor game. He missed a lot of the pushing and shoving that I've mentioned - from both sides - and failed to make the bookings that would probably have calmed things down and reminded the players of the rules.  Port Vale's Nathan Smith was involved in a number of physical challenges against Cambridge attacker Sam Smith, and they both (in my view) came close to getting booked.  

Port Vale continued to press, but the players went in at half time with no goals scored. Some of the fans near us viewed this as a glass-half-full situation, since Vale hadn't conceded either, and were on track for their first clean sheet of the season.

The referee didn't make any bookings during the first half, and consequently in the second half the game came very close to boiling over. 

The referee attempts to deal with a scuffle
without getting directly involved.
The referee steps into another scuffle, but note the two players behind him STILL fighting over the ball.

One petty incident involved a minor controversial scuffle - did he slip or was he pushed? - and one of the Cambridge players landed on the ball and  stopped to pick the ball up as he was certain he'd been fouled.  The Vale defenders argued that he hadn't been fouled, and had subsequently handled the ball immediately.  A scrum of around seven or eight players followed, each side determined to get hold of the ball (literally). The referee failed to take charge of the situation, and remained an almost impassive bystander, only booking one or two of the players, when other officials may have gone further.  It's always unfortunate when a referee manages to get himself noticed through his decisions - this was one of those games.

Cambridge United started the second half much more brightly and energetically and started gaining chances, but did not convert any of them.  As the game opened up, Vale were able to make some headway down both wings. David Amoo constantly made his presence felt in the inside right position, and kept threatening to beat the Cambridge defence.  

On the left wing, David Worrall was not having a great game.  His work rate was excellent, chasing down any opportunities on the Vale left, but he failed to make any progress and his crosses were all easily collected by the Cambridge goalkeeper, Dimitar Mitov.  Vale won a quick series of corners on the left hand side as the second half went on, but none of them produced any real chances, with Mitov proving excellent in goal and easily collecting any of the high crosses into the box. 

On the right wing, there were some nice tight passing sequences as the Vale attack attempted to break down Cambridge's deep and persistent defence, and it was through the right wing that Vale eventually got their winner.  David Amoo was able to break forwards and beat two defenders on his way into the Cambridge area; he got close to the by-line and sent a fast, low cross across the face of the goalmouth.

Retreating defender Davies beat his own goalkeeper to the ball and turned it in to the goal for an unfortunate own-goal.  Vale were able to hold on to their lead for the final five minutes (plus stoppage time) and also achieved their first clean sheet of the season, so it was a double winner that consolidated their mid-table position and allowed them to set their sights on the top half of the table.


Tuesday, 3 September 2019

Star Trek Discovery - First Impressions

Now I know I am a little late to the party, but our household recently started a Netflix subscription (primarily because we has just finished Parks and Recreation from start to end) and Mrs Leese had seen clips of Brooklyn 99 on YouTube. Brooklyn 99 is only available through Netflix, so that was that - we subscribed to Netflix.

An additional benefit is that Netflix streams Star Trek Discovery. It wasn't my idea to subscribe to Netflix, but I am not complaining!

Star Trek Discovery is the first new Star Trek series I've seen since Enterprise, and a lot has changed since then - 9/11, ISIS, the discovery of the Higgs Boson... it's a whole new world.  Star Trek has kept pace with changes in sci fi TV visuals, in the same way as the rebooted films have presented the best of Hollywood's visual effects.  But what about the audience? While Enterprise was airing in the UK, I was recording episodes on VHS video cassettes, so that I could watch episodes either live or at a time after their original air date.  It took weeks and months to get through a series (season), and by the end of a season  you could watch the series from end to end and better see the threads in the plot - if there were any.  Star Trek was entirely episodic, so you knew everything would be back to normal by the end of the hour.  In fact, season 3 of Enterprise (the Xindi arc) was widely criticised because it ran as a season-long arc and you couldn't just watch an episode in isolation (there were a few that could stand alone, but not many).

Now, with streaming services delivering on-demand TV 24/7/365, it's possible to watch Season 3 of Enterprise in a day. Not sure you'd want to, but the possibility exists.

Star Trek Discovery is able to balance the episodic nature of Star Trek with the demands of modern streaming audiences. The first two episodes are best viewed back-to-back, in the same way as TNG, DS9, Voyager and Enterprise all started with two-parters. There is a clear arc set up - the start and execution of the Klingon War - and then there are some serious differences. Observant viewers will notice that the series is called Star Trek Discovery, but the episodes start on the Shenzou. And the Captain is played by Special Guest Star Michelle Yeoh, who, as a Hollywood film actress is unlikely to be sticking around for the series. I predicted the destruction of the Shenzou with the captain on board before the opening credits had even finished.

Not that I'm complaining. The story shows us life in the Federation from the perspective of a mutinous officer who has only been saved from the brig and eventual court martial and expulsion by the needs of war.  Star Trek hasn't had a criminal in the crew since Tom Paris was pardoned and allowed to join the Voyager crew, and Lt Suder fought his violent tendencies while trying to integrate into the same crew.  This allows for some wonderful character interaction as the crew realise that they have Michael Burnham (famous mutineer) on board.  Meeting the crew from Michael's perspective means that we're thrown into the middle of a fully integrated crew - there's no shakedown time.  

The characters and names in this story are entirely fictitious. 
Any resemblance to any persons living or dead...
This is more TNG than Voyager, for sure.  Voyager started with the death of the second officer, the chief medical officer and the conn officer, throwing the Maquis and the Federation crews together.  There's none of that here; this is an established crew  who already know each other - and we don't.  The officer with the eye-enhancement (Keyla Detmar), who bears no resemblance to Seven Of Nine; the bridge officer who looks like a relative of Nebula from Guardians of the Galaxy (Airiam) - we know very little about them, except that they're bridge officers. Still, there's plenty of time for the series to show us more about them, all in good time. entirely coincidental.
So far, I have watched the first seven episodes, up to and including Magic to Make The Sanest Man Go Mad, and I am pleased to say I have thoroughly enjoyed a very new, fresh angle on the Star Trek universe. The crew have a healthy smattering of imperfections and character flaws; and when placed in a stressful war scenario, these imperfections become exposed .  The writers are not afraid to kill off characters and destroy ships with alarming frequency (the captain of the Shenzou is one example).

And there's a great balance between episodic and arcing TV. In episode five, Choose Your Pain, we meet Harry Mudd (who will go on to become a thorn in James T Kirk's side). By the end of the nearly wrapped episode, he's left to to rot in a Klingon prison, and that's a neat and tidy conclusion.  But oh, no, he's back again in the standout episode seven, Magic to Make The Sanest Man Go Mad, and he wants revenge.  Again we have another episode which reaches a firm conclusion, but now we're also wondering how long it will be before he'll be back again.

There are a few minor drawbacks to the way the story has been set up, the most noticeable being that as a prequel, we know how the story is going to end - there's no spore drive in Kirk's universe, so the ship is probably going to get destroyed eventually.  I just hope it doesn't get erased from the timeline completely ("And Spock woke up and realised it was all a dream"? No thanks).

Otherwise, I am thoroughly enjoying the new series and can wholeheartedly recommend it.

Monday, 26 August 2019

"A Puzzle A Day" - Flowers, and Venn Diagrams

The next puzzle can be solved longhand, but the best tool I would recommend is a Venn diagram, which solves the puzzle and elegantly shows your working (which my maths teachers said was always a good thing).

"Betty was making paper flowers for the local carnival.  11 flowers had red in them, seven had yellow in them, and five had red and yellow in them.  How many flowers did she make?"

The short answer (11+7+5 = 23) is incorrect; the point here is that the 11 flowers with red in them includes the five that had both red and yellow in them.  Similarly, the seven yellow flowers includes the five that had red in as well.

The quickest way to solve this is with a Venn diagram - see below.  Each circle contains the number of flowers of that colour, and the overlap shows the number of flowers which contain both red and yellow.

We know that there are five flowers which have both colours in them, so we can write 5 in the intersection (overlap) point of the two circles.  We also know that the red circle in total must contain 11 flowers, so the area outside the overlapping section is 11-5.  Finally, for the yellow the circle, the total needs be 7.

Simplifying this, we can see that there are 6 flowers that are red-only, 2 that are yellow-only, and five that are both red and yellow:

And hence the total is 13.  The initial "23" (11+7+5) counts the overlapped area twice more than it should be (i.e. it's counted as a red flower, a yellow flower and as a red-and-yellow flower).  By drawing out a simple Venn diagram, it's easy to see what the correct solution is.