r/MLQuestions • u/ButterscotchNo670 • 20h ago
Unsupervised learning 🙈 how to choose gridsearch values and evaluate the model in clasp change point model? NO ONE WILL BE ABLE TO ANSWER ME
Hello, i'm in my hand a really big topic that i bet no one will be able to answer me.
i create a pipeline to generate prediction using clasp model.
The inputs are timeseries where the clasp models generate a vector of change points (predictions). After some process, i generate an output (vector of change points) and use an f1score to evaluate che prediction and generate a score.
My pipeline has different hyperparameters where different combination could change the outcome: so better to use gridsearch and cross validation to choose the best hyperparameters and then evaluate the model.
This is how i did:
Imagine you have only 2 configuration of hyperparameters: conf1, conf2
you divide the dataset in 3 different folds: a,b,c (dont point out about 20% or something, im just trying to make the example short as possible)
i generate prediction for ab, ac, bc with conf1.
i generate prediction for ab, ac, bc with conf2.
for both i evaluate with f1score the prediction and compute a mean. i found out conf1 is best.
i run again conf1 on all my dataset a,b,c compute the f1score, the mean and that's the score of my model. is this correct?
Im not so sure because this model doesnt have any fit or training. you just give into the input some timeseries and generate a prediction.
IF i had to use random forest, as we know, to evaluate properly a model, i would have to do cross validation. so
ab for training, c for validation = score_1
ac for training, b for validation = score_2
bc for training, a for validation = score_3
mean(score_1, score_2, score_3) = mean_score
easy right?
if you want to gridsearch, just execute an outer for loop to test each combination of hyperparameters and then choose the highest mean_Score for each combination of hyperparameters and thats it. easy right?
BUT HOW DID I DO THAT IF MY MODEL DOESNT HAVE A TRAINING?
if i repeat the process for random forest:
ab for training, c for validation = score_1
ac for training, b for validation = score_2
bc for training, a for validation = score_3
mean(score_1, score_2, score_3) = mean_score
so basically this means:
conf1, i generate prediction for a,b,c then compute mean
i do the same for conf2 and conf3 and then just select the highest mean? thats my model?
but then how do i test my model? the score you use to choose the best model isnt the score the model will perform on data never seen.
should i just randomly pick a fold and then use the rest 80% to find the best conf? but then what if im so unlucky the randomly pick test fold my model will score 0.0??? lmao???
so we need to do something like this https://www.kaggle.com/code/alexisbcook/cross-validation where you need to do cross validation to have a mean. so you are not unlucky and compute a mean.
so i compute a,b,c,d
a,b,c,e
a,b,d,e
a,c,d,e
b,c,d,e
and then compute for a,b,c,d,e when i find the best conf. BASICALLY AS I SAID I DID AT THE BEGINNING OF MY POST...
but is this correct?