What's up, everyone?
If you're looking to create your first machine learning project,
then stick around.
I'm going to show you how you can use machine learning
to predict the outcome of any sports game.
Jack is from Philly and loves basketball.
He helps high school aged kids in Africa get college scholarships to play basketball,
and has even worked with a few people who have reached the pros.
He wants to build an app
that will predict the outcome of basketball games.
Let's hear from Jack.
I'm here to bring you our NBA game predictor.
This tool will forecast the outcome of NBA games.
Would you like to know the Sixers are going to beat the Knicks?
Well, of course they're going to beat the Knicks,
everybody beats the Knicks.
But if you'd like to know by how much they're going to beat the Knicks,
then this tool is for you.
Our NBA game predictor will be powered
by the number one cloud computing platform in the world, Amazon Web Services.
They have some amazing services
such as Amazon Forecast, Redshift, and Athena.
We look forward to providing you with this AWS driven tool.
I want you to turn on to what we're saying.
Tune in to the big data.
Use it as you see fit.
And then you can drop out of the rat race, and meet me on the beach of Bermuda.
Stay safe, Jack Whitehead out.
Jack wants to build an app that predicts the score of basketball games in the NBA.
Let's do this.
And now it's time to introduce the starting lineup of today's application.
Coming in at an ml.t3.large to train,
build, and deploy your machine learning models,
Amazon SageMaker!
For all your serverless compute needs at any scale,
AWS Lambda!
Fans call him the watchdog for his relentless monitoring
of AWS resources on the court and in AWS,
Amazon CloudWatch!
From Seattle, Washington, the creator, maintainer,
and security guard for APIs,
Amazon API Gateway!
And now, the NoSQL database,
handling more than 10 trillion requests per game,
Amazon DynamoDB!
Ladies and gentlemen, give it up for the starting lineup
of your machine learning application!
Based on a paper done by Professors Rory Bunker
at the University of Auckland
and Fadi Thabtah from Nelson Marlborough Institute of Technology,
there are six main steps to create a sports prediction model.
Six steps? We can do that!
Way easier than climbing the rocky steps in Jack's hometown of Philly.
The MVP of this application is Amazon SageMaker.
SageMaker is the playmaker for all six steps.
Successful machine learning requires hard to discover combinations of algorithms,
data, and parameters.
The first step is to pick a sport that you know a lot about.
Can you answer the following questions about your sport?
Who are the best players in the league?
Who are the best coaches in the league?
These are just a few questions that you'll want to answer about your sport.
I say all this because it's tempting to create a model in which
past performance indicates future performance.
But you can't necessarily follow that approach.
Your knowledge of the sport can help focus the data
that is applied to the solution.
The next step is to understand your data.
Jack is passionate about the NBA.
So in his case, he would find a data set containing game performance from the league.
A lot of sports publish data sets so you probably won't have a hard time
finding a data set, unless you're into a really niche sport.
The third step is to prepare your data and extract features.
Feature extraction is a process of producing, combining,
or creating new variables in your data set.
You'll probably need to add additional features to the data set.
For example, the NBA data set doesn't tell you
if a player is the top shot blocker in the league,
which could indicate that any team that plays against him will score fewer points.
The fourth step is modeling.
A machine learning model is a mathematical representation
of a real world problem.
It's created as a result of applying an algorithm to a set of data.
There are a lot of ways that you can go about this.
The simplest approach would be to use an algorithm called XGBoost.
XGBoost is the playbook for implementing machine learning algorithms
under the gradient boosting framework.
Amazon SageMaker has XGBoost built into the platform,
so it'll be easy to use and install.
Now that's a slam dunk.
I suggest you start with XGBoost,
and as you learn more about machine learning,
then try other methods.
During the training process, SageMaker computes several metrics
such as training errors and prediction accuracy.
These metrics can help you get a play-by-play look
at whether the model is learning well.
These metrics are written to Amazon CloudWatch in real time.
The fifth step is evaluating how the model has performed.
Typically, the amount of data that you'll reserve to evaluate your model
is 20% to 30% of the total data set.
If you're happy with the accuracy rate,
then you're ready for step number six,
which is deploying the model into production.
Use a SageMaker endpoint.
And over time, you can use SageMaker multi-model endpoint
to experiment with different models that use different approaches
to see which model performs best.
To put your input into your lineup,
you'll want to use an AWS Lambda function to call the SageMaker endpoint.
For additional security, I like to use Amazon API Gateway
as the front door to my Lambda function.
If you're looking to create a paid subscription service
and only allow a certain number of requests to your API,
check out API Gateway's usage plans.
Jack wants to allow users to be able to search his app for a team,
see the next team they're playing against,
and the predicted score of that game.
You can use Amazon DynamoDB to store the schedule of games.
You would use a Lambda function to fetch the next game
that the team is playing against.
Once you get the name of the rival team,
then you'll need to use Lambda to invoke API Gateway
in order to get the score of the game.
Now, it's time for a recap.
Lambda calls DynamoDB to get the head-to-head matchup.
The response triggers Lambda to pass the result to a request
to API Gateway to get the predicted score of the next game from Amazon SageMaker.
SageMaker passes the model to the front end via Lambda.
It takes a shot!
Oh, for the win!
Now it's time for you to build a sports prediction app.
It doesn't matter when you start, as long as you just get started.
Thanks for hanging out with me today.
See you next time.