I’ve been struggling to learn Julia for the last few days.
I’m especially interested in machine learning.
So, I’ve managed to train a decision tree model, and I’ve been able to make some predictions.
However, they came into the form of categorical distributions!
I’d like to convert them to booleans to submit my results to Kaggle (data science competition website)
then choose some cut-off threshold for classification to make a prediction based on the produced probability, e.g. pdf.(x, true) .> 0.5 (if you want to make classification at 0.5)
If you’re happy with 0.5 thresholding you can also just call mode.(x), or call predict_mode instead of predict in MLJ (which I assume you are using). The CategoricalDistributions.jl readme has more. And you may want to look at Working with Dategorical Data section of the MLJ manual.
Or you can even wrap your probabilistic model using MLJ’s BinaryThresholdPredictor to get a point-predictor and optimise the threshold to minimise your loss by wrapping again using TunedModel. There is an example in the More on Probabilistic Predictors section of the MLJ manual.
Hey that’s cool to see MLJ applied to this Kaggle competition.
I see you’ve chosen to optimise balanced rather than accuracy but note that the competition is based on the latter. I’m curious if you score any better if you use accuracy instead.
If you know other competitions that are fit for MLJ, I will gladly take a bite at them! Or if you have Julia ML framework recommendations too.
I’ve tried optimizing for accuracy instead just now, and I’ve got a lower score (0.787 < 0.788) which seems pretty logical for me, since we don’t actually know whether the testing dataset is balanced or not. They might be having a slightly unbalanced testing set to reward users who think about balancing, even though it’s not super necessary.
I’ve compared my two out.csv. About 2% of my answers changed because of using a balanced model. On the other hand, my score increased by about 0.1%, so I’m uncertain if there’s really an improvement or just pure chance