Skip to content

Commit

Permalink
create template functions for EM from scratch and EM using pomegranat…
Browse files Browse the repository at this point in the history
…e library to fill in
  • Loading branch information
ashuaibi7 committed Nov 22, 2024
1 parent f183185 commit 2d27a1b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/dialect/models/gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def compute_log_odds_ratio(self):
# ---------------------------------------------------------------------------- #
# Parameter Estimation Methods #
# ---------------------------------------------------------------------------- #
def estimate_pi_with_optimiziation(self, pi_init=0.5):
def estimate_pi_with_optimiziation_using_scipy(self, pi_init=0.5):
"""
Estimate the pi parameter using the L-BFGS-B optimization scheme.
L-BFGS-B is used because it supports bounds (0 < pi < 1), which are required
Expand Down Expand Up @@ -124,3 +124,19 @@ def negative_log_likelihood(pi):

self.pi = result.x[0]
logging.info(f"Estimated pi for gene {self.name}: {self.pi}")

def estimate_pi_with_em_from_scratch(self):
"""
Estimate the pi parameter using the Expectation-Maximization (EM) algorithm.
Implements the EM algorithm from scratch.
"""
logging.info(f"Estimating pi for gene {self.name} using the EM algorithm.")
raise NotImplementedError("EM algorithm not implemented yet.")

def estimate_pi_with_EM_using_pomegranate(self):
"""
Estimate the pi parameter using the Expectation-Maximization (EM) algorithm.
Uses the Pomegranate library for the EM algorithm.
"""
logging.info(f"Estimating pi for gene {self.name} using the EM algorithm.")
raise NotImplementedError("EM algorithm not implemented yet.")

0 comments on commit 2d27a1b

Please sign in to comment.