Skip to content

Commit

Permalink
improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AtrCheema committed Nov 3, 2022
1 parent 14aa82a commit 3ddb325
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ at one place. Currently only 1-dimensional data is supported.

## How to Install

using `pip`
You can install SeqMetrics using `pip`

pip install SeqMetrics

or using github link for the latest code
or using GitHub link for the latest code

python -m pip install git+https://github.com/AtrCheema/SeqMetrics.git

Expand Down Expand Up @@ -49,7 +49,7 @@ er.nse() # calculate Nash Sutcliff efficiency
er.calculate_all(verbose=True) # or calculate errors using all available methods
```

We can visualize the calcuated performance metrics if we have [easy_mpl]() package installed.
We can visualize the calcuated performance metrics if we have [easy_mpl](https://easy-mpl.readthedocs.io) package installed.
```python
import numpy as np
from SeqMetrics import RegressionMetrics, plot_metrics
Expand All @@ -62,12 +62,19 @@ er = RegressionMetrics(true, pred)

plot_metrics(er.calculate_all(), color="Blues")
```
# ![MLP based model](docs/source/imgs/reg1.png "Title")
# ![MLP based model](docs/source/imgs/reg2.png "Title")
# ![MLP based model](docs/source/imgs/reg3.png "Title")
# ![MLP based model](docs/source/imgs/reg4.png "Title")

Currently following regression performance metrics are being calculated.
<p float="left">
<img src="/docs/source/imgs/reg1.png" width="500" />
<img src="/docs/source/imgs/reg2.png" width="500" />
</p>

<p float="left">
<img src="/docs/source/imgs/reg3.png" width="500" />
<img src="/docs/source/imgs/reg4.png" width="500" />
</p>


`RegressionMetrics` currently, calculates following performane metrics for regression.

| Name | Name in this repository |
| -------------------------- | ------------- |
Expand Down
16 changes: 10 additions & 6 deletions SeqMetrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ def plot_metrics(
show: bool = True,
save: bool = False,
save_path: str = '',
**kwargs):
**kwargs
)->None:
"""
Plots the metrics given as dictionary as radial or bar plot between specified ranges.
Arguments:
metrics:
metrics : dict
dictionary whose keys are names are erros and values are error values.
ranges:
ranges :
tuple of tuples defining range of errors to plot in one plot
exclude:
exclude : list
List of metrics to be excluded from plotting.
max_metrics_per_fig:
max_metrics_per_fig : int
maximum number of metrics to show in one figure.
plot_type:
either of ``radial`` or ``bar``.
Expand All @@ -56,6 +57,9 @@ def plot_metrics(
kwargs:
keyword arguments for plotting
Retuns:
None
Examples:
>>> import numpy as np
>>> from SeqMetrics import RegressionMetrics
Expand All @@ -67,7 +71,7 @@ def plot_metrics(
>>> plot_metrics(all_errors, plot_type='bar', max_metrics_per_fig=50)
>>> # or draw the radial plot
>>> plot_metrics(all_errors, plot_type='radial', max_metrics_per_fig=50)
```
"""
for idx, rng in enumerate(ranges):
assert rng[1] > rng[0], f'For range {idx}, second value: {rng[1]} is not greater than first value: {rng[0]}. '
Expand Down
6 changes: 6 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# intersphinx configuration
intersphinx_mapping = {
'python': ('https://docs.python.org/{.major}'.format(
sys.version_info), None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
}

# -- Options for HTML output -------------------------------------------------

Expand Down
5 changes: 0 additions & 5 deletions docs/source/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ utility functions
*****************




Utils
========
.. autoclass:: SeqMetrics.utils.plot_metrics
:members:
:undoc-members:
:show-inheritance:

.. automethod:: __init__

0 comments on commit 3ddb325

Please sign in to comment.