Using XGBoost to make a prediction
At this point, you have a trained model, ready to be used to classify which type of iris you have based on the measurements of the sepals and petals on a flower. Let’s test out how well it does on your test dataset. To do so, you’ll need to use the predict
method and pass it the X_test
data:
- Make a prediction (classify) based on the test dataset inputs and put the answers into an array called
y_score
:y_score = iris_classifier.predict(X_test)
That’s it – just one line of code to use the model! You can pass any measurement to the model, so long as you provide values for all columns: sepal length, sepal width, petal length, and petal width. Say, for example, you’ve measured an iris and it has a sepal length of 4.5 cm, a sepal width of 3.0 cm, a petal length of 1.5 cm, and a petal width of 0.25 cm. Which type of iris is it?
- Next, make a prediction (classify) based on example measurements.
To use the model to...