-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation of distribtion class (#24)
* Add documentation of distribtion class * Update distribution.rst each sentence new line (semantic line breaks) * semantic line breaks * Extend documentation of distribution * Extend documentation for distribution --------- Co-authored-by: David Hägele <[email protected]>
- Loading branch information
1 parent
e73672c
commit d0cb18e
Showing
9 changed files
with
167 additions
and
39 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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
============ | ||
Distribution | ||
============ | ||
|
||
The `Distribution` class serves as a core component for handling probability distributions, both parametric and non-parametric. | ||
It allows you to create a distribution from either a statistical model (such as one from `scipy.stats`) or directly from a dataset (samples). | ||
The class also supports handling multivariate distributions and automatically distinguishes between univariate and multivariate cases. | ||
This class abstracts away the complexity of working with different types of distributions while providing a uniform interface for statistical operations. | ||
|
||
Creating a distribution | ||
----------------------- | ||
.. code-block:: python | ||
def __init__(self, model, name="", n_dims=1) | ||
:Parameters: | ||
- **model**: A `scipy.stats` distribution object or an array of samples. | ||
- **name** *(str)*: The name of the distribution (optional; default is inferred from the model). | ||
- **n_dims** *(int)*: Dimensionality of the distribution (optional; default is `1`). | ||
|
||
If a set of samples is passed instead of a statistical model, a Kernel Density Estimate (KDE) is used for estimating the probability density function (PDF). | ||
If the distribution is named "Normal", the class assumes the samples are from a normal distribution and fits a multivariate normal model to the data. | ||
|
||
Working with distributions | ||
-------------------------- | ||
**Distribution Properties**: Provides methods for calculating key statistical properties such as: | ||
|
||
- **mean() -> np.ndarray | float**: | ||
|
||
Returns the mean of the distribution. | ||
|
||
- **cov() -> np.ndarray | float**: | ||
|
||
Returns the covariance matrix of the distribution. | ||
|
||
- **skew() -> np.ndarray | float**: | ||
|
||
Returns the skewness of the distribution. | ||
|
||
- **kurt() -> np.ndarray | float**: | ||
|
||
Returns the kurtosis of the distribution. | ||
|
||
**Sampling and PDF Evaluation**: | ||
|
||
- **sample(n: int, random_state: int = None) -> np.ndarray**: | ||
|
||
Generates `n` random samples from the distribution. | ||
|
||
- **pdf(x: np.ndarray | float) -> np.ndarray | float**: | ||
|
||
Evaluates the probability density function (PDF) at the given point `x`. |
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
uadapy.data package | ||
======================= | ||
|
||
uadapy.data.data module | ||
----------------------------------------- | ||
|
||
.. automodule:: uadapy.data.data | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
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,8 +1,6 @@ | ||
uadapy.dr package | ||
================= | ||
|
||
Submodules | ||
---------- | ||
|
||
uadapy.dr.uamds module | ||
---------------------- | ||
|
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