O'Reilly logo

Thoughtful Machine Learning by Matthew Kirk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Support Vector Machines

What makes a user loyal or not? Loyalty in commerce generally has to do with users returning to buy things consistently over time. But how do you actually measure the deciding factor between loyal and disloyal?

In this chapter, we’ll set out to solve that problem conceptually by utilizing Support Vector Machines. This algorithm utilizes many feature objects while yielding a deciding line between one class and the other (e.g., loyal and disloyal). We’ll finish up with a worked-out example about attaching sentiment to movie reviews.

Solving the Loyalty Mapping Problem

Our online store has two sets of customers, loyal and disloyal. The loyal customers return to the site consistently and buy from the company, while the disloyal customers are either window shoppers or spendthrifts who don’t care about the company. Our goal is to determine what makes a customer loyal and disloyal with respect to the number of orders they place and their average order size.

Let’s imagine our data looks something like Figure 6-1.

loyal and disloyal customers
Figure 6-1. There’s a discernible difference between loyal and disloyal customers

As we’re approaching this problem for the first time, there are many ways we could build something to decide whether users are loyal or disloyal. We could utilize a K-Nearest Neighbors classification program (as described in Chapter 3), which effectively clusters ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required