Skip to content

Commit df6aa44

Browse files
authored
Brand change (#27)
* rebrand as noggin * remove pycache files
1 parent 6e4a661 commit df6aa44

25 files changed

+70
-251
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
src/liveplot/_version.py export-subst
1+
src/noggin/_version.py export-subst

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include versioneer.py
2-
include src/liveplot/_version.py
2+
include src/noggin/_version.py

README.md

Lines changed: 11 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/rsokl/liveplot/master?filepath=LivePlot_Demo.ipynb)
22

3-
# liveplot
4-
Log and plot metrics during train/test time for a neural network (or whatever, really). `liveplot`
5-
provides convenient i/o functions for saving, loading, and recreating liveplot sessions. It also provides
3+
# nogging
4+
Log and plot metrics during train/test time for a neural network (or whatever, really). `nogging`
5+
provides convenient i/o functions for saving, loading, and recreating nogging sessions. It also provides
66
an interface for accessing logged metrics as [xarray data sets](http://xarray.pydata.org/en/stable/index.html). This
7-
functionality, availabile via `liveplot.xarray`, permits users to seamlessly access their logged metrics as N-dimensional arrays with named axes.
7+
functionality, availabile via `nogging.xarray`, permits users to seamlessly access their logged metrics as N-dimensional arrays with named axes.
88

9-
Please consult the [demo notebook](https://github.com/rsokl/LivePlot/blob/master/LivePlot_Demo.ipynb) for a summary of `liveplot`'s functionality.
9+
Please consult the [demo notebook](https://github.com/rsokl/LivePlot/blob/master/LivePlot_Demo.ipynb) for a summary of `nogging`'s functionality.
1010

11-
![liveplot](https://user-images.githubusercontent.com/29104956/52166468-bf425700-26db-11e9-9324-1fc83d4bc71d.gif)
11+
![nogging](https://user-images.githubusercontent.com/29104956/52166468-bf425700-26db-11e9-9324-1fc83d4bc71d.gif)
1212

1313

14-
## Installing liveplot
15-
Clone/download this repository, navigate to the `liveplot` directory, and run:
14+
## Installing nogging
15+
Clone/download this repository, navigate to the `nogging` directory, and run:
1616
```shell
1717
python setup.py install
1818
```
@@ -21,7 +21,7 @@ python setup.py install
2121
### Creating a live plot
2222
```python
2323
import numpy as np
24-
from liveplot import create_plot
24+
from nogging import create_plot
2525

2626
%matplotlib notebook
2727

@@ -50,191 +50,9 @@ for i, x in enumerate(np.linspace(0, 10, 100)):
5050
plotter.plot() # ensures final data gets plotted
5151

5252

53-
from liveplot import save_metrics
53+
from nogging import save_metrics
5454

55-
# save metrics from liveplot instance
55+
# save metrics from nogging instance
5656
save_metrics("tmp.npz", plotter)
5757
```
5858

59-
### Recreating plot from saved metrics
60-
```python
61-
from liveplot import load_metrics, recreate_plot
62-
63-
train, test = load_metrics("tmp.npz")
64-
65-
colors = {"accuracy":dict(train="C4", test="C6"),
66-
"loss":"red"}
67-
68-
new_plotter, fig, ax = recreate_plot(train_metrics=train,
69-
test_metrics=test,
70-
colors=colors)
71-
```
72-
73-
## Documentation
74-
75-
```
76-
def create_plot(metrics, refresh=0., plot_title=None, figsize=None, track_time=True):
77-
""" Create matplotlib figure/axes, and a live-plotter, which publishes
78-
"live" training/testing metric data, at a batch and epoch level, to
79-
the figure.
80-
81-
Parameters
82-
----------
83-
metrics : Union[str, Sequence[str], Dict[str, valid-color]
84-
The name, or sequence of names, of the metric(s) that will be plotted.
85-
86-
`metrics` can also be a dictionary, specifying the colors used to plot
87-
the metrics. Two mappings are valid:
88-
- metric-name -> color-value (specifies train-metric color only)
89-
- metric-name -> {train/test : color-value}
90-
91-
refresh : float, optional (default=0.)
92-
Sets the plot refresh rate in seconds.
93-
94-
A refresh rate of 0. updates the once every 1/1000 seconds. A
95-
negative refresh rate will draw the plot only at the end of the session.
96-
97-
plot_title : Optional[str]
98-
Specifies the title used on the plot.
99-
100-
figsize : Optional[Sequence[int, int]]
101-
Specifies the width and height, respectively, of the figure.
102-
103-
track_time : bool, default=True
104-
If `True`, the total time of plotting is annotated in within the first axes
105-
106-
Returns
107-
-------
108-
Tuple[liveplot.LivePlot, matplotlib.figure.Figure, numpy.ndarray(matplotlib.axes.Axes)]
109-
(LivePlot-instance, figure, array-of-axes)
110-
111-
112-
def recreate_plot(liveplot=None, *, train_metrics=None, test_metrics=None, colors=None):
113-
""" Recreate a plot from a LivePlot instance or from train/test metric dictionaries.
114-
115-
Parameters
116-
----------
117-
liveplot : Optional[liveplot.LivePlot]
118-
An existing liveplot object.
119-
120-
Keyword-Only Arguments
121-
----------------------
122-
train_metrics : Optional[OrderedDict[str, Dict[str, numpy.ndarray]]]
123-
metric_name -> {"batch_data": array,
124-
"epoch_data": array,
125-
"epoch_domain": array}
126-
127-
test_metrics : Optional[OrderedDict[str, Dict[str, numpy.ndarray]]]
128-
metric_name -> {"batch_data": array,
129-
"epoch_data": array,
130-
"epoch_domain": array}
131-
132-
colors : Optional[Dict[str, color-value], Dict[str, Dict[str, color-value]]
133-
Specifying train-time metric colors only:
134-
metric-name -> color-value
135-
136-
Specifying train or test-time metric colors:
137-
metric-name -> {train/test -> color-value}
138-
139-
Returns
140-
-------
141-
Tuple[liveplot.LivePlot, matplotlib.figure.Figure, numpy.ndarray(matplotlib.axes.Axes)]
142-
(LivePlot-instance, figure, array-of-axes)"""
143-
144-
145-
146-
def save_metrics(path, liveplot=None, *, train_metrics=None, test_metrics=None):
147-
""" Save live-plot metrics to a numpy zipped-archive (.npz). A LivePlot-instance
148-
can be supplied, or train/test metrics can be passed explicitly to the function.
149-
150-
Parameters
151-
----------
152-
path: PathLike
153-
The file-path used to save the archive. E.g. 'path/to/saved_metrics.npz'
154-
155-
liveplot : Optional[liveplot.LivePlot]
156-
The LivePlot instance whose metrics will be saves.
157-
158-
train_metrics : Optional[OrderedDict[str, Dict[str, numpy.ndarray]]]]
159-
160-
metric-name -> {batch_data -> array, epoch_domain -> array, epoch_data -> array}
161-
162-
test_metrics : Optional[OrderedDict[str, Dict[str, numpy.ndarray]]]]
163-
metric-name -> {batch_data -> array, epoch_domain -> array, epoch_data -> array}"""
164-
165-
166-
def load_metrics(path):
167-
""" Load liveplot metrics from a numpy archive.
168-
169-
Parameters
170-
----------
171-
path : PathLike
172-
Path to numpy archive.
173-
174-
Returns
175-
-------
176-
Tuple[OrderedDict[str, Dict[str, numpy.ndarray]], OrderedDict[str, Dict[str, numpy.ndarray]]]]
177-
(train-metrics, test-metrics)"""
178-
179-
class LivePlot:
180-
""" Plots batch-level and epoch-level summary statistics of the training and
181-
testing metrics of a model during a session.
182-
183-
184-
Attributes
185-
----------
186-
train_metrics : OrderedDict[str, Dict[str, numpy.ndarray]]
187-
Stores training metric results data and plot-objects.
188-
189-
test_metrics : OrderedDict[str, Dict[str, numpy.ndarray]]
190-
Stores testing metric results data and plot-objects.
191-
192-
metric_colors : Dict[str, Dict[str, color-value]]
193-
{metric-name -> {'train'/'test' -> color-value}}
194-
195-
Methods
196-
-------
197-
plot(self)
198-
Plot data, irrespective of the refresh rate. This should only
199-
be called if you are generating a static plot.
200-
201-
plot_objects(self)
202-
The figure-instance of the plot, and the axis-instance for each metric.
203-
204-
Returns
205-
-------
206-
Tuple[matplotlib.figure.Figure, numpy.ndarray(matplotlib.axes.Axes)]
207-
208-
plot_test_epoch(self)
209-
210-
plot_train_epoch(self)
211-
212-
set_test_batch(self, metrics, batch_size)
213-
214-
Parameters
215-
----------
216-
metrics : Dict[str, Real]
217-
Mapping of metric-name to value. Only those metrics that were
218-
registered when initializing LivePlot will be recorded.
219-
220-
batch_size : Integral
221-
The number of samples in the batch used to produce the metrics.
222-
Used to weight the metrics to produce epoch-level statistics.
223-
224-
set_train_batch(self, metrics, batch_size, plot=True)
225-
226-
Parameters
227-
----------
228-
metrics : Dict[str, Real]
229-
Mapping of metric-name to value. Only those metrics that were
230-
registered when initializing LivePlot will be recorded.
231-
232-
batch_size : Integral
233-
The number of samples in the batch used to produce the metrics.
234-
Used to weight the metrics to produce epoch-level statistics.
235-
236-
plot : bool
237-
If True, plot the batch-metrics (adhering to the refresh rate)
238-
239-
show(self)
240-
Calls `matplotlib.pyplot.show()`. For visualizing a static-plot. """```
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
numpy == 1.15.4
22
matplotlib == 3.0.2
3-
xarray == 0.12.1
3+
xarray == 0.12.1
4+
custom_inherit == 2.2

setup.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ filterwarnings =
77
[versioneer]
88
VCS = git
99
style = pep440
10-
versionfile_source = src/liveplot/_version.py
11-
versionfile_build= liveplot/_version.py
10+
versionfile_source = src/noggin/_version.py
11+
versionfile_build= noggin/_version.py
1212
tag_prefix = v
1313

1414
[coverage:run]
15-
omit = src/liveplot/_version.py
15+
omit = src/noggin/_version.py
1616

1717
# all of the following is the configuration for tox
1818
[tox:tox]
@@ -29,4 +29,4 @@ deps = {[testenv]deps}
2929
-r requirements/coverage-requirements.txt
3030
coverage
3131
pytest-cov
32-
commands = pytest --cov-report term-missing --cov-config=setup.cfg --cov=liveplot tests
32+
commands = pytest --cov-report term-missing --cov-config=setup.cfg --cov=noggin tests

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def do_setup():
77
setup(
88
version=versioneer.get_version(),
99
cmdclass=versioneer.get_cmdclass(),
10-
name="liveplot",
10+
name="noggin",
1111
author="Ryan Soklaski",
1212
license="MIT",
1313
platforms=["Windows", "Linux", "Mac OS-X", "Unix"],

src/liveplot/__init__.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/noggin/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from noggin._version import get_versions
2+
from noggin.plotter import LivePlot
3+
from noggin.logger import LiveLogger
4+
from noggin.utils import create_plot, save_metrics, load_metrics
5+
6+
__version__ = get_versions()["version"]
7+
del get_versions
8+
9+
__all__ = ["create_plot", "save_metrics", "load_metrics", "LiveLogger", "LivePlot"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_config():
4242
cfg.style = "pep440"
4343
cfg.tag_prefix = "v"
4444
cfg.parentdir_prefix = "None"
45-
cfg.versionfile_source = "src/liveplot/_version.py"
45+
cfg.versionfile_source = "src/noggin/_version.py"
4646
cfg.verbose = False
4747
return cfg
4848

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def test_metrics(self) -> Dict[str, Dict[str, ndarray]]:
266266

267267
def to_xarray(self, train_or_test: str) -> Tuple[Dataset, Dataset]:
268268
"""
269-
Given liveplot metrics, returns xarray datasets for the batch-level and epoch-level
269+
Given noggin metrics, returns xarray datasets for the batch-level and epoch-level
270270
metrics, respectively.
271271
272272
Parameters

0 commit comments

Comments
 (0)