Now we're almost done.
One of the things that we can do at the very end of this particular notebook is prepare our test data.
We've written this nice little function up above called make full matrix so why don't we call it and
kind of run our test data through it and then save that as a file for later use.
So I had a markdown cell here that's going to read prepare a test data then I'm going to come up here
to my constants and I'll add two more file paths.
This first one I'm going to name it.
Test on the school feature at the school matrix and we're going to store it in our testing their rectory
and we'll just call this text file test hyphen features.
The second constant will call test on a school target on a school file and we'll call it test hyphen
target having set up the file paths.
I'd like to pose a challenge to you.
I'd like you to load the sparse test data and create a full matrix for the test data.
Further up in the notebook we've already loaded our data into this variable so there's no need to load
it again when making the function call to create the full matrix from the test data.
Add some micro benchmarking code to it time that function call.
Figure out how long it takes.
Afterwards separate the features and the target values and save these as separate Dot T X T files preferably
using the relative paths that we added earlier.
Test on escort target on a score file and test on the score a feature on the score matrix.
I'll give you a few seconds to pause the video and have a go at this and here's the solution.
So are sparse on a squat test on a score data we've already loaded up and this whole thing had the following
shape about one hundred and ten thousand rows and four columns.
The micro benchmarking will add with percent percent time and I'll store the results of our function
call in a variable called full on a score test score data.
This will hold on to the result from make on a score full on a score matrix which as an input will take
all sparse test data and for the number of words we'll use vocab on a score size hitting shift enter
on this should make our computer run between 5 and 10 seconds after that.
I'll create two further variables x underscore test and X on a score test.
I'll set equal to full test data dot and low C so when I create a subset square brackets.
Colon comma and then I'll say full test data columns not equal to exclamation mark equals single quotes.
Category for my target values y underscore test.
I'll set those equal to full test data.
Don't category.
There we go.
Now all I'm gonna do is save both of these pieces of information to a file with NDP dot safety x t parentheses
test target file comma Y on a school test.
This is where our target value is gonna be saved and with NDP dot safe text parentheses test feature
metrics how safe X on a school test.
And that's it before I hit shift enter on this I'll very quickly bring up my folder on my hard drive
right here and then we can see it being created.
Fantastic.
Well we've done quite a lot of legwork up till now and we've put ourselves in a great position to finally
run our algorithm and make some predictions.
We've trained our model.
We've got all our data ready.
We're now ready to put our base classifier through its paces and on that note I'll say See you in the
next listen.
Goodbye.
As we say back home in Austria Savills take her.