# 1st Place solution

I started with
[@taylorsamarel](https://www.kaggle.com/taylorsamarel)
's baseline notebook (i dont know why it is now deleted) but I utilised some of the preprocessing steps it used and made my own version with minimal preprocessing and shared it publicly
[here](https://www.kaggle.com/code/paritoshtripathi5/public-load-train-val-and-test-data)
.
From the
[original work](https://git.tu-berlin.de/bvt-htbd/kiwi/tf3/raman-and-nir/-/tree/main?ref_type=heads)
I noticed they were doing extensive preprocessing such as MSC, savgol filter, normalisation. With help of gemini I included other preprocessing steps too and experimented with various combinations of these preprocessing steps and their parameter, on each device's spectrometer data by a simple grid search.
This sequence yielded the best results for all spectrometers -
Original Spectra -> MSC -> Baseline correction -> Smoothing -> Scaling
R2 scores for other spectrometers
Device0 Score: 0.62
Device1 Score: 0.83
Device2 Score: 0.92
Device3 Score: 0.92
Device4 Score: 0.95
Device5 Score: 0.96
Device6 Score: 0.84
Device7 Score: 0.91
I had another interesting find but I did not use that in my final solution. The glucose readings from the test spectrometer was linearly related to the glucose readings from other spectrometers. These experiments are included in
[this notebook v3](https://www.kaggle.com/code/paritoshtripathi5/map-idea)
for reference.
I finalized my approach with these preprocessing steps.
The final solution was weighted average of my best solution which was an autogluon ensemble
[here](https://www.kaggle.com/code/paritoshtripathi5/fork-of-preprocess-autogluon)
(weight = 0.6) and best public solution
[here](https://www.kaggle.com/code/nguyenlamphuquy/pca-lr-extraregressiontree)
(weight = 0.4)
Autogluon models were trained for 1hr/target = 3hrs with preset='best_quality'
But,
A simple hgb model with the preprocessing steps outperforms the second best solution and I have shared that too
[here](https://www.kaggle.com/code/paritoshtripathi5/final-solution-notebook/)
This notebook only takes 45 seconds to train and generate submission, and can be used for efficiency.
I tried other methods from the original work like PLS but they did not yield any better results than my setup.
I hope this clarifies everything
[@rosahassfurther](https://www.kaggle.com/rosahassfurther)
P.S. I wrote this in a bit of a rush, so couldn't clean up my code and apologies for any errors.