This PR introduces a refactored Param class to represent parameter specifications in HSSM.
Before the refactor, Param was a single class that both accepts user inputs and performs internal processing, such as merging with default values and truncating priors, which made the code in the class very messy. Some of the functionalities also bled into the HSSM class, which bloated the class as well. The refactor aims to separate the concerns of the old Param class into multiple classes, each taking one responsibility of the Param class. This completely moves the concerns out of the HSSM class, making the main class much less bloated (even though there is still room for improvement).
The improvements are:
A user-facing UserParam class, which is exported as hssm.Param, for storing user input. (closes #564)
An internal Param class that defines some common functionalities for the parameter representation. (closes #560)
Inheriting the Param class is the SimpleParam class, which handles the situation where the parameter is not a regression. Its subclass DefaultParam handles the situation where the prior is not specified in the non-regression case (where we do not truncate the prior). (closes #561)
The RegressionParam class for handling the regression case (closes #562)
A dict-like Params class for creating these params both from user specification, or defaults, or both. It also takes away some of the responsibilities of the HSSM class (closes #559)
Tests for all these new classes are under tests/param directory.
The refactor also removes "hierarchical" argument to HSSM, adding global_formula instead. (closes #431, #432)
Some other changes to other code files are necessary for this gigantic refactor to work, but most of the changes are under src/hssm/param.
This PR introduces a refactored
Param
class to represent parameter specifications in HSSM.Before the refactor,
Param
was a single class that both accepts user inputs and performs internal processing, such as merging with default values and truncating priors, which made the code in the class very messy. Some of the functionalities also bled into the HSSM class, which bloated the class as well. The refactor aims to separate the concerns of the oldParam
class into multiple classes, each taking one responsibility of the Param class. This completely moves the concerns out of the HSSM class, making the main class much less bloated (even though there is still room for improvement).The improvements are:
UserParam
class, which is exported ashssm.Param
, for storing user input. (closes #564)Param
class that defines some common functionalities for the parameter representation. (closes #560)Param
class is theSimpleParam
class, which handles the situation where the parameter is not a regression. Its subclassDefaultParam
handles the situation where the prior is not specified in the non-regression case (where we do not truncate the prior). (closes #561)RegressionParam
class for handling the regression case (closes #562)Params
class for creating these params both from user specification, or defaults, or both. It also takes away some of the responsibilities of the HSSM class (closes #559)Tests for all these new classes are under
tests/param
directory.The refactor also removes "hierarchical" argument to
HSSM
, addingglobal_formula
instead. (closes #431, #432)Some other changes to other code files are necessary for this gigantic refactor to work, but most of the changes are under
src/hssm/param
.