Skip to content

Commit

Permalink
Update distribution.py
Browse files Browse the repository at this point in the history
add random state parameter for resampling kde
  • Loading branch information
hageldave authored May 6, 2024
1 parent 776195e commit 3b864da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uadapy/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, model, name="", dim = 1):

def sample(self, n: int, random_state: int = None) -> np.ndarray:
if isinstance(self.model, np.ndarray):
return self.kde.resample(n).T
return self.kde.resample(n, random_state).T
if hasattr(self.model, 'rvs') and callable(self.model.rvs):
return self.model.rvs(size=n, random_state=random_state)
if hasattr(self.model, 'resample') and callable(self.model.resample):
Expand Down Expand Up @@ -99,4 +99,4 @@ def kurt(self) -> np.ndarray | float:
if hasattr(self.model, 'stats') and callable(self.model.stats):
return self.model.stats(moments='k')
if isinstance(self.model, stats.multivariate_normal):
return 0
return 0

0 comments on commit 3b864da

Please sign in to comment.