Skip to content

Commit

Permalink
Merge pull request #54 from gibsramen/misc-fixes
Browse files Browse the repository at this point in the history
Misc fixes
  • Loading branch information
gibsramen authored Jul 27, 2021
2 parents 1542bcb + 517901a commit bb4ab24
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
18 changes: 13 additions & 5 deletions birdman/default_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,25 @@ class NegativeBinomialSingle(SingleFeatureModel):
y_{ij} &\\sim \\textrm{NB}(\\mu_{ij},\\phi_j)
\\mu_{ij} &= n_i p_{ij}
\\textrm{alr}(p_i) &= x_i \\beta
\\log(\\mu_{ij}) &= \\log(\\textrm{Depth}_i) + x_i \\beta
Priors:
.. math::
\\beta_j &\\sim \\textrm{Normal}(0, B_p), B_p \\in \\mathbb{R}_{>0}
\\begin{cases}
\\beta_j \\sim \\textrm{Normal}(-5.5, B_p), & j = 0
\\frac{1}{\\phi_j} &\\sim \\textrm{Cauchy}(0, C_s), C_s \\in
\\beta_j \\sim \\textrm{Normal}(0, B_p), & j > 0
\\end{cases}
.. math::
B_p \\in \\mathbb{R}_{>0}
.. math::
\\frac{1}{\\phi_j} \\sim \\textrm{Cauchy}(0, C_s), C_s \\in
\\mathbb{R}_{>0}
Expand Down
6 changes: 0 additions & 6 deletions birdman/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ class BaseModel(ABC):
:param table: Feature table (features x samples)
:type table: biom.table.Table
:param metadata: Metadata for design matrix
:type metadata: pd.DataFrame
:param model_path: Filepath to Stan model
:type model_path: str
Expand Down Expand Up @@ -239,9 +236,6 @@ def to_inference_object(self) -> az.InferenceData:
class SingleFeatureModel(BaseModel):
"""Fit a model for a single feature."""
def __init__(self, table: biom.Table, feature_id: str, **kwargs):
if feature_id is None:
raise ValueError("Must provide feature ID!")

super().__init__(table=table, **kwargs)
self.feature_id = feature_id
values = table.data(
Expand Down
3 changes: 2 additions & 1 deletion birdman/templates/negative_binomial_single.stan
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ transformed parameters {
model {
// setting priors ...
reciprocal_phi ~ cauchy(0., phi_s);
for (j in 1:p){
beta[1] ~ normal(-5.5, B_p);
for (j in 2:p){
beta[j] ~ normal(0., B_p); // uninformed prior
}
// generating counts
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc'
'sphinx.ext.autodoc',
'sphinx.ext.mathjax'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down

0 comments on commit bb4ab24

Please sign in to comment.