Skip to content

Commit

Permalink
simplify init for CovModel
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengp0 committed Jun 25, 2024
1 parent 8b5d8b0 commit 0942ac9
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/mrtool/core/cov_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,11 @@ def create_z_mat(self, data):

def create_constraint_mat(self) -> tuple[NDArray, NDArray]:
"""Create constraint matrix.
Returns:
tuple{numpy.ndarray, numpy.ndarray}:
Return linear constraints matrix and its uniform prior.
Returns
-------
tuple[NDArray, NDArray]
Return linear constraints matrix and its uniform prior.
"""
# initialize the matrix and the value
c_mat = np.array([]).reshape(0, self.num_x_vars)
Expand Down Expand Up @@ -682,9 +684,11 @@ def create_constraint_mat(self) -> tuple[NDArray, NDArray]:

def create_regularization_mat(self) -> tuple[NDArray, NDArray]:
"""Create constraint matrix.
Returns:
tuple{numpy.ndarray, numpy.ndarray}:
Return linear regularization matrix and its Gaussian prior.
Returns
-------
tuple[NDArray, NDArray]
Return linear regularization matrix and its Gaussian prior.
"""
r_mat = np.array([]).reshape(0, self.num_x_vars)
r_val = np.array([]).reshape(2, 0)
Expand Down Expand Up @@ -813,9 +817,6 @@ def num_regularizations(self):
class LinearCovModel(CovModel):
"""Linear Covariates Model."""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def create_x_fun(self, data: MRData):
"""Create design function for the fixed effects."""
alt_mat, ref_mat = self.create_design_mat(data)
Expand Down Expand Up @@ -855,12 +856,6 @@ def create_z_mat(self, data):
class LogCovModel(CovModel):
"""Log Covariates Model."""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# if self.use_spline_intercept:
# raise ValueError("LogCovModel does not support use_spline_intercept."
# "Please set it to False, or leave it as default.")

def create_x_fun(self, data):
"""Create design functions for the fixed effects.
Expand Down

0 comments on commit 0942ac9

Please sign in to comment.