Skip to content

Commit

Permalink
Torch instances (#25)
Browse files Browse the repository at this point in the history
* Change doc theme

* Add numpy/pytorch instance types and change to index based classification

* Rebuild notebooks

* Fix dataset downloads

* Update doctests
  • Loading branch information
tachyonicClock authored Mar 21, 2024
1 parent 3603bc3 commit 4d9ee91
Show file tree
Hide file tree
Showing 33 changed files with 3,904 additions and 3,119 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
run: |
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
python -m pip install ".[dev]"
- name: Cache Test Datasets
id: cache-test-datasets
uses: actions/cache@v4
with:
path: data
key: "test-datasets"
- name: PyTest
run: invoke test.unit
- name: Notebooks
Expand Down
24 changes: 23 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.. _api:

API
===

Expand Down Expand Up @@ -27,16 +28,37 @@ Instances are the basic unit of data in CapyMOA.
:inherited-members:
:show-inheritance:

.. autoclass:: capymoa.stream.instance.NpInstance
:members:
:inherited-members:
:show-inheritance:

.. autoclass:: capymoa.stream.instance.NpLabeledInstance
:members:
:inherited-members:
:show-inheritance:

.. autoclass:: capymoa.stream.instance.NpRegressionInstance
:members:
:inherited-members:
:show-inheritance:

Stream
------
A datastream is a sequence of instances arriving one at a time.


.. automodule:: capymoa.stream
.. automodule:: capymoa.stream.stream
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

.. autoclass:: capymoa.stream.PytorchStream.PytorchStream
:members:
:undoc-members:
:show-inheritance:
:inherited-members:


Learners
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"sphinx.ext.doctest",
]

autoclass_content = 'both'

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

Expand All @@ -36,7 +38,7 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_theme = "sphinx_book_theme"
html_static_path = ['_static']

# Setup symbolic links for notebooks
Expand Down
13 changes: 5 additions & 8 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ are written in the form of examples in a python interactive shell.

Use this type of test for simple examples and as a way to document the code.

CapyMOA uses the `sphinx.ext.doctest <https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html#module-sphinx.ext.doctest>`_
to add these tests in the documentation. Here is an example of a doctest::

"""
.. doctest:: python

>>> print("Hello, World!")
def hello_world():
"""
>>> hello_world()
Hello, World!
"""
"""
print("Hello, World!")

They can be run with the following command::

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ get the correct version for your hardware.

Install CapyMOA
---------------
Within the activated environment, you can install CapyMOA with pip:
To install CapyMOA, you can use pip:

.. code-block:: sh
Expand Down
2 changes: 1 addition & 1 deletion invoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ moa_url: "https://homepages.ecs.vuw.ac.nz/~antonlee/capymoa/moa.jar"

# What notebooks to skip when running them as tests.
test_skip_notebooks:
- notebooks/Using_jpype_MOA_example.ipynb
# - my_notebook.ipynb
Loading

0 comments on commit 4d9ee91

Please sign in to comment.