Random Forest Classifiers as a Web Service in PHP

Recently, I found myself wanting to be able to make real-time, online predictions using a random forest classifier trained in R. Of course, there are many ways to make that happen – I could have used yhat’s ScienceOps product, for example. But, for project-specific reasons, I decided that the best route to go in this case was to get my hands dirty and build my own RESTful API for making predictions using my model.

Apparently, back in 2011, Disney debuted a show called "So Random." Thankfully, it only ran for a single season...

Apparently, back in 2011, Disney debuted a show called “So Random.” Thankfully, it only ran for a single season…

In this post, we’ll walk through all of the code necessary to export a random forest classifier from R and use it to make real-time online predictions in a PHP script.

Continue reading

Probabilities in Google Analytics Content Experiments

Have you ever taken a look at the “probability of outperforming” metric in Google Analytics’ Content Experiments and wondered how it was calculated? Have you ever scratched your head because the numbers didn’t make sense to you? I certainly have. It’s hard to see experiment results like the ones depicted below and not wonder what’s going on underneath the hood.

GA Experiment Data

Real data from a GA content experiment, showing an under-performing variant with a >50% chance of outperforming the original. It’s like trash-talking when you’re down at the half.

In this post, we’ll highlight how Google’s Content Experiments work, why it’s a really smart idea, and why you might still want to do a little bit of the heavy lifting yourself…

Continue reading

Are Your Affiliate Partners Cannibalizing Organic Sales?

What if your business was paying a bunch of extra money to bring in sales that would have happened anyway?

In the e-commerce business, affiliate marketing promises to deliver increased sales by getting your name and products showing up on dozens of sites, blogs, and social media pages. Of course, this sounds like a great boon – more traffic, more sales, more profits. But, in many cases, the results aren’t nearly as good as you might expect. If you’re not careful, your affiliate program can cannibalize sales that were going to happen anyway…

Cutco knives seem like the 1990's equivalent of affiliate marketing...Image Credit: Hustvedt  [CC BY-SA 3.0 or GFDL], on Wikimedia Commons)

Cutco knives – affiliate marketing’s evil twin brother.
(Image Credit: Hustvedt [CC BY-SA 3.0 or GFDL], on Wikimedia Commons)

In today’s post, I’ll show you a simple technique to figure out how cannibalistic your affiliate program is, using a specially-designed Google Analytics segment.

Continue reading