This tutorial covers the following:
- How to use K Nearest Neighbour to predict whether stock prices will close above 99.5%*(today’s close)
- How to get the confusion matrix, classification report and ROC curve
- How to do hyperparameter tuning using a grid search
- How to do forward chaining with time series (using TimeSeriesSplit)
- How to code a simple trading strategy using K Nearest Neighbour
Understanding the confusion matrix and classification report
Positive = Predicted Positive
Negative = Predicted Negative
TP = True Positive = Instances that are correctly predicted as positive
FP = False Positive = Instances that are incorrectly predicted as positive
TN = True Negative = Instances that are correctly predicted as negative
FN = False Negative = Instances that are incorrectly predicted as negative
Precision = Out of all the instances whose predicted values are positive, how many are true positives
Recall = Out of all the instances whose actual values are positive, how many are true positives
Leave a Reply