nifreeze.model.base module¶
Base infrastructure for nifreeze’s models.
- class nifreeze.model.base.BaseModel(self, dataset, **kwargs)[source]¶
Bases:
ABCDefines the interface and default methods.
Implements the interface of
dipy.reconst.base.ReconstModel. Instead of inheriting from the abstract base, this implementation follows type adaptation principles, as it is easier to maintain and to read (see https://www.youtube.com/watch?v=3MNVP9-hglc).Base initialization.
- abstract fit_predict(index: int | None = None, **kwargs) ndarray | None[source]¶
Fit and predict the indicated index of the dataset (abstract signature).
If
indexisNone, then the model is executed in single-fit mode meaning that it will be run only once in all the data available. Please note that all the predictions of this model will suffer from data leakage from the original volume.- Parameters:
index (
intorNone) – The index to predict. IfNone, no prediction will be executed.
- class nifreeze.model.base.ExpectationModel(self, dataset, stat='median', **kwargs)[source]¶
Bases:
BaseModelA trivial model that returns an expectation map (for example, average).
Initialize a new model.
- nifreeze.model.base.MASK_ABSENCE_WARN_MSG = 'No mask provided; consider using a mask to avoid issues in model optimization.'¶
Mask warning message.
- class nifreeze.model.base.ModelFactory(self, /, *args, **kwargs)[source]¶
Bases:
objectA factory for instantiating data models.
- nifreeze.model.base.PREDICTED_MAP_ERROR_MSG = 'This model requires the predicted map at initialization'¶
Oracle requirement error message.
- class nifreeze.model.base.TrivialModel(self, dataset, predicted=None, **kwargs)[source]¶
Bases:
BaseModelA trivial model that returns a given map always.
Implement object initialization.
- nifreeze.model.base.UNSUPPORTED_MODEL_ERROR_MSG = 'Unsupported model <{model}>.'¶
Unsupported model error message