‫In the last video, we saw how we might find some of the most ideal hybrid parameters for our random
‫forest for aggressor.
‫But we only set the number of or in my case, you might have done this differently.
‫You might have had some more time.
‫But in the essence of time for recording these videos, I only set an ETA to two.
‫However, in a previous experiment a.k.a Step six, I set an ETA to 100 and found some more ideal hybrid
‫parameters in what we have here.
‫So that's what we'll do.
‫We're going to in this video, trying to model with the best hyper parameters.
‫And we'll put a little note here.
‫We'll go note these were found after 100 iterations of randomized search.
‫CV And now if you were to do something like this, like 100 iterations of randomized search CV, you
‫still may find different height parameters, potentially better height parameters.
‫That high parameter searching are like finding the best height parameters for model is as we've talked
‫about before, it's not an exact science.
‫It involves a lot of trial and error, a lot of experimentation.
‫So for this one, you're just going to have to kind of trust me that I've run this 100 iterations.
‫It took a couple of hours on my Mac, so I'll just show you which ones we found so most ideal type of
‫parameters.
‫And that way, once we've gone through something like this, a randomized search CV defines some ideal
‫hybrid parameters because this was only I'm scrolling back and forth here because this was only trained
‫on 10,000 examples.
‫What you'll probably do is use randomized search CV to find some ideal hyper parameters across a space
‫like this on a subset, because otherwise it would take hours and hours and hours and then retrain.
‫A model on the full data set, which is what we're about to do now with the most ideal hyper parameters
‫that were found in randomized search TV.
‫So let's call this one ideal model and we'll set it up here.
‫Right now for us, regress us.
‫So in my case, an estimate as was 40.
‫Now, this is interesting, right?
‫Because the default in random forest regress are if we go here shift tab, the default is 100.
‫So it's actually from the randomized search.
‫It's actually found that 100 estimate is weren't required.
‫So 40 still provides pretty good results.
‫Min samples leaf was found to be one and then median samples split was found to be 14 and then max features
‫was found to be 8.5 and end jobs.
‫Of course, we're going to set to negative one because we want our computer to use all of the processes
‫that it has.
‫Well, in my case, I do.
‫Max samples equals none because why we want to train on all of the data.
‫So we set max samples to none.
‫AKA it will train on as many samples as possible.
‫And now we're going to fit the ideal model because we've just instantiated above ideal model don't fit
‫on the training data X train, y train.
‫And now this might take a couple of minutes.
‫So what we'll do, I'll run this cell and again we're going to time travel and once the training is
‫complete, we'll be able to see how long it took because we've got time and then we'll evaluate our
‫model.
‫Beautiful.
‫So that took about one minute and 14 seconds.
‫Now that's on the entire data.
‫And the reason being is probably the main reason is because an estimate as is 40 rather than 100.
‫So what that means is the random forest is building 40 smaller little models rather than 100.
‫So almost two and a half times less.
‫And I did forget one parameter that we probably should have put in here.
‫Random state equals 42.
‫I'm not going to rerun the model now, but just so it's there, I'll put a little comment here.
‫Random state.
‫So this is so if we were to set an umpire random seed, same thing, random state.
‫So our results are reproducible.
‫Is that so reproducible?
‫Yes, it is a beautiful.
‫So if I was to run this cell again over and over and over with random state set to 42, we would get
‫the same model being fit.
‫But that took about one minute, 14 seconds on my computer.
‫It may take a little bit longer, a little bit shorter on your computer, depending on how much processing
‫power you have.
‫And if you're running randomized search of a number of times more than what we've done up here, you
‫may potentially find different parameters to what I've found here.
‫And if you have, I encourage you to share them so other people can try them out and.
‫We'll evaluate it to see how they go, to see whose parameters are the real best ones.
‫So let's check it out with our handy show.
‫Scores function and we'll pass it our model that we just trained.
‫Shift an end to their.
‫Beautiful.
‫And because this is trained on all the data, we should see a significant improvement over the model
‫that we trained before.
‫So let's go up.
‫Here we go.
‫RS model.
‫Okay.
‫What we might do is bring these closer to each other so we can go scores for ideal model.
‫Trained on all the data and let's go here.
‫Scores on RS model only trained on 10,000 examples.
‫The exact same line of code.
‫We ran a couple of cells up.
‫I'm just doing it here so we can directly compare them.
‫All right.
‫So let's look at here.
‫The valid arms, Ali, is probably the one we want to pay most attention to.
‫As you can see, with our ideal model, in one minute, 14 seconds of training time, it's gone through
‫400 or so thousand rows and reduced the valid arms.
‫LEE Arms.
‫LEE Yep, that's a mouthful by what is it about 0.8.
‫So that's pretty -- good.
‫And if we saw with this, we were already doing well on the competition with our original model.
‫Let's see where our new and improved one, which is our ideal model.
‫So we're looking at this here valid root mean square log error point two, four, six.
‫Where does that get us on the leaderboard?
‫.246.
‫All right.
‫So a round about there.
‫So 30.
‫So we're almost in the top 30 on the Kaggle leaderboard, just in a model that took a minute to run.
‫And going through here, this is a random forest.
‫Regresses straight out of psychic learn.
‫That's pretty -- impressive.
‫And we haven't really done an incredible amount of data manipulation.
‫We've turned our data into numbers, we've filled missing value, but we're already getting some incredible
‫results.
‫So what we'll probably do is leave our ideal model there.
‫We could search for longer with randomized search CV up here and find some better high parameters and
‫probably slightly improve our model even more.
‫Maybe push us right into the top 25.
‫That'd be pretty cool.
‫But what we might do now is see how we'd make a submission to Kaggle.
‫So what does this mean?
‫So if we come here, how do you even get on the leaderboard?
‫Well, if we go here to Data.
‫To get on the leaderboard.
‫We have to make some predictions on test CSV.
‫So right now our predictions are invalid.
‫CSV.
‫But all of these scores on the leaderboard.
‫So really we are just guesstimating where we'd end up because we're predicting on valid CAC at the moment,
‫we're evaluating our model on a validation set.
‫But if we come back to overview and evaluation, what we have to do is submit a submission file.
‫So OC submission file should be formatted as follows sales ID sale price.
‫So that's what we probably might do.
‫Now we might import the test data set and formatted in a way so we can use our machine learning model
‫on it and create an example submission in the format that Kaggle is asking of us.
‫So that sounds like a good plan.
‫Now we've got an ideal model.
‫We'll use that to make predictions on the test data set.