>> In this video, we will look at how to build
custom machine learning model for predicting taxi fares.
What is price prediction?
Price prediction is about predicting of
taxi fare or a fare amount based on some input data.
For example, how long was the taxi ride?
How many customers or riders were in the taxi?
So here's an example of a dataset from
the New York taxi fare which
captures the historical data of all the rides that happened.
In this case, let us understand how would price prediction work.
Price prediction is an example of
a regression machine learning task
which can be used to predict a number.
For example, predicting taxi fare,
predicting house pprices, or anything else.
The prediction for taxi fare works as follows.
You have some features which go into the training process.
So for example, these features can determine
how high or low was the fair amount,
and for example if the distance traveled was very high,
then most likely, the fare is going to be big as well.
Then the fare amount is your label
or output column or the column that you want to predict.
So this is the outcome of calling a machine learning model.
Now that we have understood the basics of predicting taxi fares,
let's look at how can we build
a custom machine learning model for this scenario.
This is a console app that I have
and I'm going to use this to build a price prediction model.
I've already downloaded the ModelBuilder Visual Studio tool,
so I can right-click my app and say "Add Machine Learning".
This will launch ModelBuilder.
I can choose from a variety of templates.
So in this case, since I am predicting taxi fares,
I'm going to choose
the price prediction template which predicts
a numerical value from my historical dataset.
So I'm going to choose that template,
and the second step in the machine learning process is
around connecting to your data and loading it.
I can choose to load by file or SQL server.
In this case , since I've downloaded
the New York taxi dataset which is a CSV file,
I can choose file and I can navigate to that dataset.
Once the data gets loaded,
I indicate a preview of what the data looks like.
It's showing me the 10 rows
of all these rows and about seven columns,
and I can then choose the column that I want to predict
or the label column and this case is the fair amount,
and the fair amount becomes my label column.
I can use these features and the data to
train a model by simply saying start training.
The longer I train the model for,
the better model I'll get.
Underneath the covers, ModelBuilder
uses automated machine learning,
which explores various models with
different settings and gives me the best moral.
So I don't have to worry about finetuning
the model for my specific case.
So in this case, once the is training completed,
I got quality or accuracy of 94 percent,
and the best algorithm was LightGbm regression.
I can go to the evaluate screen and I can
understand more in terms of what happened in the system.
For example, while the best model was like LightGbm regression,
the tool also explored
other models and it's showing me a summary of
the top five models explored along with
the accuracy and other characteristics that I can use.
So I can use this information to further evaluate or to gain
trust in the system that
it's not a black box where I got my result,
but there were other results as well.
If I'm happy with the evaluation criteria,
I can then go to the code step which is
the last step of your machine learning workflow,
which is around consuming the model.
I can click "Add projects" which is
going to add two projects to my solution.
One project which has the code for how the model
was trained in ModelBuilder.cs and
a class library which has the actual model
that was trained and I can include it in my application.
So let's go ahead and add a reference to
the class library project so I can consume it in my app.
So I'm going to say "Add Reference" to
the class library and say "Okay" and I can
use this code in my program.cs to consume the model in my app.
I'm going to add a few using
statements for the class library I included,
and then what this code does over here,
it creates an ML context,
and then it loads the model,
it creates the Prediction Engine which I can
use to predict a value and I can give
some values around what was my trip distance?
Equals 100.
What was my trip time in seconds?
Which is around 1,000 So I can play around with
all these values and then call
the predict function to predict
the fair amount and I can write it to the console as well.
So I can do result.score which is going to
be the prediction value for the fair amount.
So I'm going to run this application.
It looks like I'm missing a semicolon here,
so that's why it's getting errors.
So I'm going to relaunch it,
and what's happening is
the machine learning model is loading the model,
and it's going to give me a score which is
what was the fair amount for my process?
So what we saw in this video was how to
build a machine learning model for predicting taxi fares.
In the next video,
we will look at how to build a model for recommending movies.