Skip to content

Commit

Permalink
Minor changes suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanbabbar04 committed Jan 19, 2025
1 parent 469be83 commit 5174e4f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion preliz/distributions/chi_squared.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def mean(self):
return self.nu

def mode(self):
return max(self.nu - 2, 0)
return np.maximum(self.nu - 2, 0)

def median(self):
return self.ppf(0.5)
Expand Down
2 changes: 1 addition & 1 deletion preliz/distributions/discrete_uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def mean(self):
return (self.upper + self.lower) / 2

def mode(self):
return np.nan
return (self.upper + self.lower) / 2

def median(self):
return np.floor((self.upper + self.lower) / 2)
Expand Down
2 changes: 1 addition & 1 deletion preliz/distributions/kumaraswamy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def mean(self):

def mode(self):
return np.where(
(self.a > 1) & (self.b > 1), ((self.a - 1) / (self.a * self.b - 1)) ** (1 / self.a), 1
(self.a > 1) | (self.b > 1), ((self.a - 1) / (self.a * self.b - 1)) ** (1 / self.a), 0.5
)

def median(self):
Expand Down
2 changes: 1 addition & 1 deletion preliz/distributions/truncatednormal.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def mean(self):
)

def mode(self):
return max(self.lower, min(self.upper, self.mu))
return np.maximum(self.lower, np.minimum(self.upper, self.mu))

def median(self):
alpha = (self.lower - self.mu) / self.sigma
Expand Down
2 changes: 1 addition & 1 deletion preliz/distributions/wald.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def mean(self):

def mode(self):
return self.mu * (
(1 + (9 * self.mu**2) / (4 * self.lam**2)) ** 0.5 - 3 * self.mu / 2 * self.lam
(1 + (9 * self.mu**2) / (4 * self.lam**2)) ** 0.5 - (3 * self.mu) / (2 * self.lam)
)

def median(self):
Expand Down

0 comments on commit 5174e4f

Please sign in to comment.