matchms / ms2deepscore

Deep learning similarity measure for comparing MS/MS spectra with respect to their chemical similarity
Apache License 2.0
52 stars 23 forks source link

Consider combining different "MS2DeepScore 2" models into one class #204

Open florian-huber opened 7 months ago

florian-huber commented 7 months ago

With #201 we have 3 different models for different steps, which can be confusing. @niekdejonge proposed to consider ways of merging them into one class.

florian-huber commented 7 months ago

To make things more user friendly, we could simply merge the EmbeddingEvaluator and the Linear Model into the SiameseSpectralModel.

niekdejonge commented 7 months ago

My first idea was actually to keep the EmbeddingEvaluator and the LinearModel as separate classes, but to save them to the same file. However, I like the idea of having the option to just calculate embeddings and embedding evalutations. Saving and loading them in one file would reduce the risk of accidental mismatching models that are not compatible. But it could also be confusing to have multiple models stored in one file...

To make this possible we would need to save the embedding_evaluator_state_dict and the ms2deepscore_state_dict under separate keys and during loading use the state dict for each. For the EmbeddingEvaluator I would make it only possible to save to an already existing file that already contains the MS2Deepscore model (you need that model anyway).