Skip to content

Draft: Refactor base model

Nicolas Gensollen requested to merge refactor-base-model into v2

What does the code in the MR do ?

This is still work in progress.

The goal of this MR is to refactor a bit the BaseModel class. More precisely, the idea is to move "up" some logic from the AbtractModel class which is currently doing a lot of things. Note that the GenericModel class gets also simplified in the process.

When doing this refactoring I got a bit confused by the concept of "hyperparameters". It seems like this term refers to both:

  • some special attributes of a model instance (for example features, dimension, or source_dimension)
  • some variables of the State defined using the HyperParameter class (for example sources_std or log_v0_std )

The AbstractModel had a hyperparameters_names method retrieving the latter while other parts of the code were considering the former (see save method of the GenericModel for instance).

At the moment, I implemented the hyperparameter getters as returning everything in a model instance which could be considered as such (i.e the model hyperparameter attributes AND the variables from the state if the model has one).

If we want to have such behavior, I will have to fix some broken tests, but I'm not sure this is the right move.

Let me know what you think.

Where should the reviewer start ?

How can the code be tested ?

When is the MR due for? (review deadline)

What issues are linked to the MR ?

Merge request reports