Making Money from AI by Predicting Sales - Jay's Intro to AI Part 2
Key Takeaways
The video discusses the application of AI in machine learning for business, specifically in predicting sales through time series forecasting, and introduces the four basic steps to create a prediction model. It also explores how businesses can make money from AI by predicting sales and demand, using tools like decision.ai and techniques like linear regression.
Full Transcript
prediction is the most commonly used application of ai in machine learning in business today what are the four steps that go into creating a prediction model how can we use more than one piece of information one feature to make a prediction these are two topics that we'll discuss in this video and then we'll go talk about one of the most important applications of ai in machine learning forecasting sales or predicting sales we'll talk about how that works in stores and in platforms and in other types of businesses and in hospitals and energy companies welcome back to jay's intro to ai this is the second video in the first video we talked about prediction about making an estimate based on existing historical numbers that we have and we discussed an example of an ice cream shop it looks like this and we said if we had three people who walked into an ice cream shop how much would they end up paying to answer this question we said okay there are four steps in the high level prediction recipe let's say this is vastly oversimplified but it's important to know so first we decided what we want to predict right and that is the dollar amount of the transaction and then when we want to make a prediction the second step would be to prepare the data and that would be collecting the data would be getting it from different places merging it visualizing it transforming it in in different ways and this is really the most important part of this entire process and a lot of the time and effort and know-how really go into this second step of preparing the data sometimes we're not able to find the data that we want to make that prediction and so we need to decide on something else to predict but then once we have enough data and we've analyzed it enough we can start experimenting with models and we start creating prediction models and we evaluate them maybe we end up with good models maybe we don't and if we don't we have to go back to the data stage and work on our data maybe transform it in different ways that enable the models make better predictions and it's very common to when you're working on models to go back and work on the data a little bit more before you're able to come up with with the final prediction model that is able to solve your problem once we have a model that we like we can roll it out and start allowing it to make predictions and so this is a very high level vastly oversimplified recipe for making prediction models after some time maybe we gather more data we can train the model once again and then roll it back out now let's look at how we use this prediction recipe in our ice cream example and so we said we wanted to predict the dollar amount of uh of the sale of the transaction how much ice cream or how much money would we generate from these people these group of three people walking into an ice cream shop we prepared data and so we said okay let's look at the previous three examples that happened in this store there was a group of one person who purchased for ten dollars it was a group of two people who purchased ice cream for twenty dollars and then there was a group of four people who purchased ice cream for forty dollars now we have never seen a group of three people walk into this ice cream shop before and so we asked ourselves despite that we've never seen a group of three people is there anything we can learn or infer from this data set that allows us to to make a guess or an estimate or a prediction of how much a group of three people would pay and so this is an intuitive question and it's an easy data set and we said okay so the green column which is called the features is related to the pink column which is the label and this relationship can be explained by the number 10. so whenever we multiply any value here by the number 10 this is a simple relationship or pattern that we found between these two columns and so we can say okay we can come up with a prediction model that just takes in a feature multiplies it by this weight the value of 10 and then that is the prediction and so this is the model training process the training is coming up with that proper weight that explains the relationship between the two columns and so now we have a prediction model we pass it the number three as input it multiplies three by ten and it makes the prediction of 30. so these are the two four simple steps of the prediction recipe this is how we looked at them in the first video and in this video we'll take them one step further to incorporate multiple features and so let's change our example a little bit more let's say this let's say we have a group of two adults and one child how much would they pay and so that's we still have the same uh first step what to predict we're still predicting sales but then we can look at the data a little bit differently we can say the previous three transactions in the same ice cream shop how many adults were there in each group and how many children and here we can see that the first group had only one child ended up paying five dollars one adult paid 10. one adult and one child paid 15. is there a way we're confined to map this relationship and this is a data set that's again vastly oversimplified just to make the the main concepts and when i ask this to people generally they're able to come up with the answer it seems that children usually buy for five dollars and adults usually buy for ten dollars and so that is our prediction model we assigned a weight to each of the columns that we have and so we can start to make predictions how do we make the the prediction in this case we have feature number one is number of adults and then region number two is number of children we pass these to the model each feature we multiply it by the weight associated with it so we say 2 times 10 is 20 1 times 5 is 5. we add those up boom that is our prediction 25 and that's a simple way of saying okay we can extend our model to any number of columns we just assign a different weight to each column and in the training process we we are able to find that that those weights that explain this relationship in our data set notice that this is oversimplified in a number of different ways right so some of them is that this is a very clean data set in the in the actual world uh data sets are not this you know close cut so you would find that different children walk in some of them would pay nothing some of them would buy for 10 would buy for eight for pi for three so but it's it's always good i find to to start from somewhere simple and then build up the complexity and so on and so forth so now that you know how to do two uh features you can use four features and you can take a data set of you know predicting the the prices of houses based on the area the number of bedrooms in the house the number of bathrooms maybe you want to calculate distance to near near schools you just assign a weight to each column and you make a prediction and so this is one of the simplest ways to make a prediction model and it's extremely powerful and important and it's called linear regression there are vast number of other models but this is a really good place to start and a lot of businesses can benefit tremendously just by using this and it's it's it's a great model to to to start with because i wanted to build an understanding for a simple model so you know the exact the the other parts of the recipe and then you can move on to more complex models if you'd like now that we've covered the prediction recipe and we've looked at how to use more than one feature up to you know thousands or millions of features to make predictions let's talk a little bit about the business application and i'm selecting these applications that i'll be talking about in this video and the upcoming videos trying to make sure that they're useful everywhere in the world and in every country as much as possible because there are if you look at machine learning there are some applications some problems that are you know only useful in certain places or you have to get a phd to be able to use let's say machine learning to detect cancer or solve some of these problems so we've looked at a the ice cream shop and we say okay it's a store selling something to buyers so we have seller side and a buyer side there is supply side and a demand side let's say we start the week with only three scoops of strawberry ice cream in our inventory now what happens if during the week customers demand six scoops we'll be able to satisfy the first three and then for the other three we'll say we're sorry we're out of strawberry ice cream and so we'll not be able to sell them some of these customers will switch to another flavors some of them we just lost the sale and so this is a business problem called under stock and so we did not have enough stock of the item to satisfy the demand of of the customers and so that resulted in lost sales if we had somebody working on machine learning for for us at the store and they say okay let's look at the historical record of sales that happened in the store and then they predicted that this week we'll sell six scoops of strawberry ice cream and based on this the business went out and stocked more ice cream so they had six um they would be able to increase their sales right because they were able to satisfy the demand as that was predicted accurately and so this is one way that is important for you to know of how machine learning is useful for businesses by predicting demand you can increase sales and make more revenue this is important and this is a very powerful idea i want you to be equipped by the power of knowing how to use data to make predictions and to deploy ai and machine learning but also you need to understand where that is creating value for businesses because understanding the the intersection of these two you'll be able to develop your skills and potentially you know start businesses that solve these problems to to various companies so it's it's very important for you to realize where the value is being created by machine learning application in this case it was to increase sales and we'll look at another example that's probably that is actually a lot more important so ice cream you can store ice cream for months or years maybe and it will not spoil but what about milk and dairy and cheese let's say we start the week we're a grocery store and we have three bottles or gallons of milk and then at the end of the week only one of them is purchased that's the only amount that buyers wanted what do we end up with here so we had two bottles that were not sold and so we had overstock and so we lost money we wasted shelf space and we you know maybe purchased this and either us or the dairy company is losing money on this unsold because at the end of the week it's spoiled milk does not live forever it will spoil in four or five days you can say the same about a lot of other fresh foods and so here the problem is overstock which we had more stock than we should have had in the store and we overstocked a fresh item that perished and expired and that even made the laws even larger and so having prediction models that are able to detect and decrease over stock can cut the costs and cutting that cost is also creating value and so understanding how you can increase revenue or cut costs how an application of ai maps to solving these business problems to a business or a company in this case either the store itself or the dairy company or the logistics company shipping the dairy between the stores or the farm itself all of this factors and i want to bring your attention to a different problem we're not just talking about saving money for businesses ai is extremely powerful as a tool and it will have in its already having tremendous impact on humanity and so when you have this power to make prediction machines that foretell the future you always have to think about the consequences and this is a huge responsibility for everybody who's interested in ai and wants to you know think and learn about ai and deploy ai and in this case losing uh milk and having it spoil has more effects beyond just you know losing that that that bottle or the money that was invested in this think about that about 30 percent of of dairy um between 15 and 30 is is the number is actually wasted and so that's milk that is extremely expensive to make how expensive uh you know this is one glass costs this much of co2 emissions into the atmosphere it requires a lot of land it's you know a lot of water is used to create every um cup of or glass of of milk and so this waste is really dramatic and it goes beyond the farm or the dairy company or the supermarket every one of us pays the price for that and what are the you know the consequences so this is a problem that you can focus on and solve and share what you learn and other people in other places of the world are able to you know improve the efficiency of their dairy companies and their supermarkets uh this can have a tremendous impact on on humanity because you know the planet heats up the ice glaciers melt sea water rises we have floods and that creates misery for people floods are already happening but then this stuff will happen a lot more in the future and machine learning is one of the very powerful tools that should be that we should be always thinking about deploying to solve our biggest problems one of them being climate change and so this is generally called time series forecasting so if you have a list of numbers let's say sales for each day that is called a time series and this is an icon i created for this kind of model just to say that you know we have previous historic data here in blue this model is able to predict potentially how it's going to evolve in the future prediction usually requires a lot of data so not just for data points not just three examples we'll need hundreds if not thousands or millions of data points to be able to create good predictions but these are all examples and they're all they're just symbolic we've talked about ice cream we've talked about milk think about every product in the supermarket these are fast moving consumer goods companies they and their competitors always have to think about the different products how much of them to stock in different stores in the city so these are all business problems that are that need to be to be addressed tonight this is value that you can create i believe for these companies and for their competitive competitors uh one example i love uh interactive visualizations so you can go to decision.ai and they have a link called example and they say they give you a an example of four stores that you let's say own and they've predicted the demand for a certain product and you have a choice here so you have to move this slider and you choose to say okay do i supply 100 of the predicted value or less and it gives you um different results uh because it's a bit more complex of a problem if you're thinking thinking about multiple stores and so this is a real world example based on on real data that i that i've enjoyed one other domain where forecasting is extremely important is when you think about transportation or companies like uber or lyft or dd or karim in our part of the world right hailing companies basically now these companies also have sellers and buyers they have supply and demand and for them predicting demand and predicting supply would lead to a better marketplace if they can predict them and then balance them using whatever tools that they have so let's think about this let's say that a city is broken into two zones and this one city has this one zone has six people waiting for at five pm six people logged into the app and requested rides but there were only two available rides here problem is the other region has enough drivers uh but they're a bit far so how do you solve this this is a problem four of these people will have to wait a long time to get a ride and you would lose your marketplace would lose a lot of money in this in this scenario these writers would just switch to your competitor so what these companies do now what you can do at 5 pm is to say that ok this is a surge area and when these drivers see that they can get more money by taking picking up passenger in this region they would move but this would take a lot of time if you only do it at 5 pm what you can do is that at 4 pm you can predict you can have a forecast and make a prediction about how much traffic or how many people are going to be requesting rides at 5 pm and you have a lot of historical data to build that prediction and so what you do is that at 4 pm this is the traffic that you currently have and then at 4 pm you make a prediction of how many riders are going to be there and how many cars are going to be there and so if there isn't enough cars to satisfy that demand you do the surge pricing before five and so at four you have you incentivize these drivers to go to this area to satisfy this demand that's what these companies and like delivery companies food delivery companies call shaping the fleet and it uses predicting for forecasting or predicting demand and supply and then balancing where there is a mismatch in that you can think of other places where the same problem can be solved so think about let's say hotels so hotel chains or companies like airbnb or booking.com if you think that or you forecast or you accurately predict that a certain city or destination will have more tourists visiting then you have properties in that place you can go to that city let's say and sign up more hotels for your platform or more properties to to host these people and so you can think about the problem in you know domain of hour the scope of hours if you're in ride hailing or in weeks or months if you're in the hotel industry um the same problem also can be thought of in the domain of hospitals and so if you're a hospital you would want to predict how many inpatients are going to be visiting you just to know how much to staff up your your uh your hospital and try to reduce uh how how crowded the hospital is energy companies and utility companies can gain a lot from accurately accurately predicting uh the usage on their networks and the demand and supply if you think of any business in terms of supply and demand and you you have enough data and ability to forecast them you can create a lot of value this concludes the second video in our our talk about about predicting and forecasting sales and supply and demand and the like in using just time series forecasting uh hope you've enjoyed it please subscribe and like and let me know what you think and what other topics you'd like me to discuss i have a few more ideas that i'd like to throw your way and applications that i'm that i'm working on for the next videos but always willing and i love to hear all of your feedback thank you for watching
Original Description
Learn about the four basic steps to make predictions, about making predictions using more than one piece of data (feature), and about how businesses around the world can make money from AI by predicting sales (time series forecasting). This and more in the second video in this visual introduction to AI.
Contents:
Introduction (0:00)
The prediction recipe (0:42)
Using two features to make a prediction (4:58)
Business application: Predicting sales in a store (to prevent understock and overstock) (8:17)
Predicting supply and demand in marketplaces and ride-hailing (Uber, Lyft) (17:04)
Twitter: https://twitter.com/JayAlammar
Blog: https://jalammar.github.io/
----------
Decision.AI example for prediction: http://decision.ai/
Forecasting at Uber: https://www.youtube.com/watch?v=bn8rVBuIcFg
------
Music performance rights Markus Staab
https://musopen.org/music/2634-piano-concerto-no-20-in-d-minor-k-466/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Jay Alammar · Jay Alammar · 2 of 38
1
▶
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Jay's Visual Intro to AI
Jay Alammar
Making Money from AI by Predicting Sales - Jay's Intro to AI Part 2
Jay Alammar
How GPT3 Works - Easily Explained with Animations
Jay Alammar
The Narrated Transformer Language Model
Jay Alammar
My Visualization Tools (my Apple Keynote setup for visualizations and animations)
Jay Alammar
Explainable AI Cheat Sheet - Five Key Categories
Jay Alammar
The Unreasonable Effectiveness of RNNs (Article and Visualization Commentary) [2015 article]
Jay Alammar
Neural Activations & Dataset Examples
Jay Alammar
Up and Down the Ladder of Abstraction [interactive article by Bret Victor, 2011]
Jay Alammar
Probing Classifiers: A Gentle Intro (Explainable AI for Deep Learning)
Jay Alammar
Inspecting Neural Networks with CCA - A Gentle Intro (Explainable AI for Deep Learning)
Jay Alammar
Language Processing with BERT: The 3 Minute Intro (Deep learning for NLP)
Jay Alammar
Behavioral Testing of ML Models (Unit tests for machine learning)
Jay Alammar
Favorite AI/ML Books: Intro to ML with Python (Book Review)
Jay Alammar
Favorite Python Books: Effective Python
Jay Alammar
Favorite Stats Books: Seven Pillars of Statistical Wisdom
Jay Alammar
Understanding Animal Languages - Seeing Voices 2
Jay Alammar
How digital assistants like Siri work #shorts
Jay Alammar
Writing Code in Jupyter Notebooks #shorts
Jay Alammar
Experience Grounds Language: Improving language models beyond the world of text
Jay Alammar
pandas for data science in python #shorts
Jay Alammar
The Illustrated Retrieval Transformer
Jay Alammar
AI Image Generation is MIND BLOWING! #shorts
Jay Alammar
A Generalist Agent (Gato) - DeepMind's single model learns 600 tasks
Jay Alammar
The Illustrated Word2vec - A Gentle Intro to Word Embeddings in Machine Learning
Jay Alammar
AI Art Explained: How AI Generates Images (Stable Diffusion, Midjourney, and DALLE)
Jay Alammar
What is Generative AI? 4 Important Things to Know (about ChatGPT, MidJourney, Cohere & future AIs)
Jay Alammar
AI is Eating The World - This is Where YOU Can Use it to Compete (AI Product Moats)
Jay Alammar
What is LangChain? Where does it fit with LLMs like ChatGPT and Cohere? #shorts
Jay Alammar
Are language models with more parameters better? #shorts #chatgpt
Jay Alammar
How to manage LLM prompts with tools like LangChain #languagemodels #chatgpt
Jay Alammar
What is Llama Index? how does it help in building LLM applications? #languagemodels #chatgpt
Jay Alammar
prompt chains are important for building large language model applications
Jay Alammar
ChatGPT has Never Seen a SINGLE Word (Despite Reading Most of The Internet). Meet LLM Tokenizers.
Jay Alammar
What makes LLM tokenizers different from each other? GPT4 vs. FlanT5 Vs. Starcoder Vs. BERT and more
Jay Alammar
Building LLM Agents with Tool Use
Jay Alammar
SWE-Bench authors reflect on the state of LLM agents at Neurips 2024
Jay Alammar
Learn how ChatGPT and DeepSeek models work: How Transformer LLMs Work [Free Course]
Jay Alammar
More on: Supervised Learning
View skill →Related Reads
📰
📰
📰
📰
Why Revisiting Old Databricks Concepts Made Me a Better Learner
Medium · Data Science
Day 96: Data Catalog Service - AI System Design in Seconds
Dev.to · Matt Frank
Data Science Institute in South Extension — Learn Python, AI & Machine Learning
Medium · Data Science
How to Scrape Airbnb Market Data (Prices, Ratings, Availability) at Scale
Dev.to · PsyMall
🎓
Tutor Explanation
DeepCamp AI