Skip to content

Commit 8e5158d

Browse files
authored
Merge pull request #28 from mu373/plot-functions
Add plot functions
2 parents c1ad2d8 + bac676c commit 8e5158d

File tree

10 files changed

+1556
-25
lines changed

10 files changed

+1556
-25
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This section provides detailed API documentation for the tailestim package.
88

99
base
1010
estimators/index
11+
estimator-set
1112
result
1213
data
1314

docs/estimator-set.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Estimator Set
2+
=============
3+
4+
.. automodule:: tailestim.estimators.estimator_set
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
Examples
10+
--------
11+
12+
.. code-block:: python
13+
14+
from tailestim import TailData, TailEstimatorSet
15+
import matplotlib.pyplot as plt
16+
17+
data = TailData(name='CAIDA_KONECT').data
18+
19+
estim_set = TailEstimatorSet()
20+
estim_set.fit(data)
21+
22+
estim_set.plot()
23+
plt.show()
24+
25+
estim_set.plot_diagnostics()
26+
plt.show()

examples/example.ipynb

Lines changed: 153 additions & 21 deletions
Large diffs are not rendered by default.

examples/example.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from tailestim import TailData
22
from tailestim import HillEstimator, KernelTypeEstimator, MomentsEstimator
33

4+
from tailestim import TailEstimatorSet
5+
import matplotlib.pyplot as plt
6+
47
# Load a built-in dataset
58
data = TailData(name='CAIDA_KONECT').data
69

@@ -19,4 +22,13 @@
1922
gamma = result.gamma
2023

2124
# Print full results
22-
print(result)
25+
print(result)
26+
27+
# Compare multiple estimators and plot results
28+
estim_set = TailEstimatorSet.fit(data)
29+
estim_set.plot()
30+
plt.show()
31+
32+
# You can also plot diagnostic plots
33+
estim_set.plot_diagnostics()
34+
plt.show()

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ classifiers = [
2424
"Programming Language :: Python :: 3.13",
2525
]
2626
dependencies = [
27-
"numpy>=1.19"
27+
"numpy>=1.19",
28+
"matplotlib>=3.5"
2829
]
2930

3031
[project.urls]

src/tailestim/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5+
from .datasets import TailData
6+
57
from .estimators.base import BaseTailEstimator
68
from .estimators.hill import HillEstimator
79
from .estimators.moments import MomentsEstimator
810
from .estimators.kernel import KernelTypeEstimator
911
from .estimators.pickands import PickandsEstimator
1012
from .estimators.smooth_hill import SmoothHillEstimator
11-
from .datasets import TailData
13+
14+
from .estimators.estimator_set import TailEstimatorSet
1215

1316
__all__ = [
17+
'TailData',
1418
'BaseTailEstimator',
1519
'HillEstimator',
1620
'MomentsEstimator',
1721
'KernelTypeEstimator',
1822
'PickandsEstimator',
1923
'SmoothHillEstimator',
20-
'TailData',
24+
'TailEstimatorSet',
2125
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Estimators for tail index estimation."""
2+
3+
from .base import BaseTailEstimator
4+
from .hill import HillEstimator
5+
from .moments import MomentsEstimator
6+
from .kernel import KernelTypeEstimator
7+
from .pickands import PickandsEstimator
8+
from .smooth_hill import SmoothHillEstimator
9+
from .estimator_set import TailEstimatorSet
10+
11+
__all__ = [
12+
'BaseTailEstimator',
13+
'HillEstimator',
14+
'MomentsEstimator',
15+
'KernelTypeEstimator',
16+
'PickandsEstimator',
17+
'SmoothHillEstimator',
18+
'TailEstimatorSet',
19+
]

0 commit comments

Comments
 (0)