With Halloween fast approaching, it’s time to talk about what’s on everyone’s mind: Christmas!
Although I’m speaking tongue in cheek, you cannot deny the power of the winter holidays on retail sales. In 2016, 101.7 million people braved the crowds to save money on their holiday shopping - many of them chasing the elusive “doorbusters” which have come to define Black Friday. We may have another word for these promotions: “loss leaders".In this blog post, I’d like to discuss a novel way to look at loss leaders through the lens of machine learning.
Let’s talk about decision policies.
“I’m in business to make money. I should only do business when it makes money.” What a fantastic policy! It’s both simple and easy to understand (remember, KISS). We could even encode it:
if product.sale_price > product.procurement_cost:
“I’m in business to make money. I should focus on products with the highest margins.” Again, a fantastic policy!
return product.sale_price - product.procurement_cost
return optimizer.maximize(score, products)
More realistically we need to consider the customer needs, what brings them into the store, how much volume we can reasonably expect to move. People will go to the store with the cheapest underwear first, then they may make a purchase on a handbag or licensed tee. A business using this simple strategy may quickly go out of business.
Let’s talk about shipping
Brief detour: I can’t describe a customer purchasing both beer and diapers without opening a can of worms about market research big data and assumptions. So let's talk about something I can throw on a map: Trucks.
A shipping company makes money by moving goods from Origin to Destination. A shipping company optimizes profits by minimizing the cost to get to an Origin, or “deadhead”. A traditional assignment looks something like this:
def score(truck, order):
revenue = distance(order.origin, order.destination)
cost = distance(truck.location, order.origin)
return revenue - cost
def assign(trucks, orders):
return optimizer.maximize(score, trucks, orders)
But in the shipping industry, we have a problemwith Miami. We have very high demand to move goods toMiami, but very low demand to move goods out of Miami.
Miami is like underwear. Miami is a loss leader.
In this situation, our assignment scheduler would love to send trucks to Miami with its high revenue score. Conversely, our scheduler may force trucks to wait in Miami for long periods of time until a desirable order comes on the market, reducing our volume
Here are some example results:
Machine Learning to the Rescue
Instead of optimizing on scoreLet’s use machine learning to make a new metric based on score.
We can look at not just the immediate value of completing an order, we could consider the value of subsequent orders. By simulating many permutations of assignments, we can build up a historical database of orders and then use machine learning to estimate the added value of a particular assignment.
def machine_learning_score(truck, order):
return model.predict(truck, order)
def machine_learning_assign(trucks, orders):
return optimizer.maximize(machine_learning_score, trucks, orders)
By employing this method, I generated the following results:
The model learned a way to score the orders such that the same assignment optimizer maintained a fairly consistent revenue/cost ratio while increasing volume by 11%.
This shipping company will enjoy a much nicer Christmas after this particular Black Friday.
Tying it back together.
Everyone wants to have simple policies. But competing in the open marketplace requires a complex balance between low and high margin options, sometimes even accepting a loss to increase business.
With machine learning a group may maintain a simple and easy to understand policy while still serving the needs and desires of their customers. if you have questions about this blog or want to meet with our technical team, please reach out to firstname.lastname@example.org!