-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Took 1 hour 19 minutes
- Loading branch information
Showing
28 changed files
with
211 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
# Contains helper functions for testing SklarPy multivariate code | ||
import os | ||
import numpy as np | ||
|
||
from sklarpy.multivariate import * | ||
from sklarpy import load | ||
|
||
__all__ = ['get_dist'] | ||
|
||
|
||
def get_dist(name: str, d: int = 3) -> tuple: | ||
def get_dist(name: str, params_dict: dict, data: np.ndarray = None) -> tuple: | ||
"""Fits a distribution to data. | ||
Parameters | ||
---------- | ||
name : str | ||
The name of the distribution as in distributions_map | ||
d: int | ||
The dimension of the data. | ||
params_dict: dict | ||
Dictionary containing the parameters of each distribution. | ||
data: np.ndarray | ||
Multivariate data to fit the distribution too if its params are not | ||
specified in params_dict. | ||
Returns | ||
------- | ||
res: tuple | ||
non-fitted dist, fitted dist, parameters for fitted dist | ||
""" | ||
dist = eval(name) | ||
path: str = f'{os.getcwd()}\\sklarpy\\tests\\multivariate\\{name}_{d}D' | ||
params = load(path) | ||
fitted = dist.fit(params=params) | ||
if name in params_dict: | ||
params: tuple = params_dict[name] | ||
fitted = dist.fit(params=params) | ||
else: | ||
fitted = dist.fit(data=data) | ||
params: tuple = fitted.params.to_tuple | ||
return dist, fitted, params |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-573 Bytes
sklarpy/tests/multivariate/multivariate_marginal_hyperbolic_2D.pickle
Binary file not shown.
Binary file removed
BIN
-629 Bytes
sklarpy/tests/multivariate/multivariate_marginal_hyperbolic_3D.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-556 Bytes
sklarpy/tests/multivariate/multivariate_sym_gen_hyperbolic_2D.pickle
Binary file not shown.
Binary file removed
BIN
-604 Bytes
sklarpy/tests/multivariate/multivariate_sym_gen_hyperbolic_3D.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-529 Bytes
sklarpy/tests/multivariate/multivariate_sym_marginal_hyperbolic_2D.pickle
Binary file not shown.
Binary file removed
BIN
-577 Bytes
sklarpy/tests/multivariate/multivariate_sym_marginal_hyperbolic_3D.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.