From 5fe9cf3d9b9c7cc97c726f7876b194f6fc177d7e Mon Sep 17 00:00:00 2001 From: Anton Lee <37557393+tachyonicClock@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:24:05 +1300 Subject: [PATCH] Add Sphinx documentation (#13) --- .github/workflows/documentation.yml | 34 ++++++++++++++ .gitignore | 2 +- README.md | 10 +++-- docs/Makefile | 20 +++++++++ docs/README.md | 36 +++++++++++++++ docs/conf.py | 38 ++++++++++++++++ docs/index.rst | 33 ++++++++++++++ docs/make.bat | 35 +++++++++++++++ docs/source/capymoa.datasets.rst | 29 ++++++++++++ docs/source/capymoa.evaluation.rst | 29 ++++++++++++ docs/source/capymoa.learner.classifier.rst | 45 +++++++++++++++++++ docs/source/capymoa.learner.regressor.rst | 21 +++++++++ docs/source/capymoa.learner.rst | 30 +++++++++++++ docs/source/capymoa.rst | 32 +++++++++++++ docs/source/capymoa.stream.rst | 21 +++++++++ docs/source/modules.rst | 7 +++ .../{DEMO.ipynb => 00_getting_started.ipynb} | 2 +- ...b => 01_evaluation_and_data_reading.ipynb} | 34 +++++++------- ...s.ipynb => 02_learners_api_examples.ipynb} | 8 ++-- ...h.ipynb => 03_using_sklearn_pytorch.ipynb} | 2 +- ...tream_API.ipynb => 04_drift_streams.ipynb} | 20 ++++----- pyproject.toml | 6 +++ 22 files changed, 454 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/documentation.yml create mode 100644 docs/Makefile create mode 100644 docs/README.md create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/source/capymoa.datasets.rst create mode 100644 docs/source/capymoa.evaluation.rst create mode 100644 docs/source/capymoa.learner.classifier.rst create mode 100644 docs/source/capymoa.learner.regressor.rst create mode 100644 docs/source/capymoa.learner.rst create mode 100644 docs/source/capymoa.rst create mode 100644 docs/source/capymoa.stream.rst create mode 100644 docs/source/modules.rst rename notebooks/{DEMO.ipynb => 00_getting_started.ipynb} (99%) rename notebooks/{Evaluation_and_Data_Reading.ipynb => 01_evaluation_and_data_reading.ipynb} (99%) rename notebooks/{MOALearners_API_Examples.ipynb => 02_learners_api_examples.ipynb} (99%) rename notebooks/{Using_sklearn_pytorch.ipynb => 03_using_sklearn_pytorch.ipynb} (99%) rename notebooks/{DriftStream_API.ipynb => 04_drift_streams.ipynb} (99%) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..43eceb11 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,34 @@ +name: "Build Documentation" +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths: + - '**.py' + - '.github/workflows/unit_test.yml' + - 'pyproject.toml' +jobs: + documentation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + cache: 'pip' # caching pip dependencies + - name: Install Dependencies + run: | + sudo apt-get install -y pandoc + python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu + python -m pip install ".[dev,doc]" + - name: Build Documentation + run: | + cd docs + make html + - name: Upload Documentation + uses: actions/upload-artifact@v4 + with: + name: docs + path: docs/_build/html \ No newline at end of file diff --git a/.gitignore b/.gitignore index 27d419d0..1cf1c5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -172,5 +172,5 @@ src/capymoa/jar/moa.jar condaenv.*.requirements.txt data notebooks/*.png - +docs/notebooks *tfevents* \ No newline at end of file diff --git a/README.md b/README.md index fef5c440..03667322 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,12 @@ Python wrapper for MOA to allow efficient use of existing algorithms with a more # Tutorial notebooks These notebooks show how to do things. Data is available in the ```/data/``` directory (some of which will need to be downloaded, see instrucitons there). -* **DEMO.ipynb**: Contains simple examples on how to execute classification and regression, using MOA objets to configure synthetic generators or classifiers/regressors. -* **Evaluation_and_Data_Reading.ipynb**: Many examples showing how to perform different evaluations for classification and regression using different methods (i.e. a loop or buildin functions). -* **Learners_API_Examples.ipynb**: Similar to the DEMO, but shows more capabilities of the evaluator and learner objects. -* **Using_sklearn_pytorch.ipynb**: Shows how one can use the API to run sklearn algorithms (those that implement ```partial_fit```) and PyTorch models. +* [`00_getting_started.ipynb`](notebooks/00_getting_started.ipynb): Contains simple examples on how to execute classification and regression, using MOA objets to configure synthetic generators or classifiers/regressors. +* [`01_evaluation_and_data_reading.ipynb`](notebooks/01_evaluation_and_data_reading.ipynb): Many examples showing how to perform different evaluations for classification and regression using different methods (i.e. a loop or buildin functions). +* [`02_learners_api_examples.ipynb`](notebooks/02_learners_api_examples.ipynb): Shows more capabilities of the evaluator and learner objects. +* [`03_using_sklearn_pytorch.ipynb`](notebooks/03_using_sklearn_pytorch.ipynb): Shows how one can use the API to run sklearn algorithms (those that implement ```partial_fit```) and PyTorch models. +* [`04_drift_streams.ipynb`](notebooks/04_drift_streams.ipynb): Shows how to setup + simulated concept drifts in data streams. # Test notebooks These show how some parts of the library were developed and provide comparisons of different options on how to do things. diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..9b22db38 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @python -m $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @python -m $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..9caffd43 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,36 @@ +# Contributing to Docs +There are three source of documentation in this repository: + + 1. Auto-generated documentation from the source code using Autodoc. See this + [link](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html) + for more information. + + 2. Juptyer notebooks in the `/notebooks` directory are converted to markdown + files and included in the documentation with `nbsphinx`. See this + [link](https://nbsphinx.readthedocs.io) for more information. + + To add a notebook to the documentation, add the notebook to the + `/notebooks` directory and add the filename to the `toctree` in + `index.rst`. + + 3. Manually written documentation in the `/docs` directory. + +## Prerequisites +Install the documentation dependencies by running the following command in the +root directory of the repository: + +```bash +pip install --editable ".[doc,dev]" +``` + +## Building the Documentation +To build the documentation, run the following command in `/docs`: + +```sh +make html +``` + +Or on Windows: +```cmd +make.bat html +``` diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..84f118ba --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,38 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os +from pathlib import Path + +project = 'CapyMOA' +copyright = '2024, Heitor Murilo Gomes, Anton Lee, Nuwan Gunasekara, Marco Heyden' +author = 'Heitor Murilo Gomes, Anton Lee, Nuwan Gunasekara, Marco Heyden' +release = '0.0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ['sphinx.ext.autodoc', 'nbsphinx', 'sphinx.ext.mathjax'] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ['_static'] + +# Setup symbolic links for notebooks + +notebooks = Path("../notebooks") +notebook_doc_source = Path("notebooks") +if not notebook_doc_source.exists(): + os.symlink(notebooks, notebook_doc_source) + diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..d2010f30 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,33 @@ +.. CapyMOA documentation master file, created by + sphinx-quickstart on Fri Feb 23 08:41:28 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to CapyMOA's documentation! +=================================== + +.. toctree:: + :maxdepth: 1 + :caption: Tutorials: + + notebooks/00_getting_started.ipynb + notebooks/01_evaluation_and_data_reading.ipynb + notebooks/02_learners_api_examples.ipynb + notebooks/03_using_sklearn_pytorch.ipynb + notebooks/04_drift_streams.ipynb + +.. toctree:: + :maxdepth: 1 + :caption: Modules: + + source/capymoa.datasets + source/capymoa.evaluation + source/capymoa.learner + source/capymoa.stream + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..32bb2452 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/capymoa.datasets.rst b/docs/source/capymoa.datasets.rst new file mode 100644 index 00000000..29a1c55e --- /dev/null +++ b/docs/source/capymoa.datasets.rst @@ -0,0 +1,29 @@ +Datasets +======================== + +Submodules +---------- + +capymoa.datasets.datasets module +-------------------------------- + +.. automodule:: capymoa.datasets.datasets + :members: + :undoc-members: + :show-inheritance: + +capymoa.datasets.downloader module +---------------------------------- + +.. automodule:: capymoa.datasets.downloader + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.datasets + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.evaluation.rst b/docs/source/capymoa.evaluation.rst new file mode 100644 index 00000000..31dcddfe --- /dev/null +++ b/docs/source/capymoa.evaluation.rst @@ -0,0 +1,29 @@ +Evaluation +========================== + +Submodules +---------- + +capymoa.evaluation.evaluation module +------------------------------------ + +.. automodule:: capymoa.evaluation.evaluation + :members: + :undoc-members: + :show-inheritance: + +capymoa.evaluation.visualization module +--------------------------------------- + +.. automodule:: capymoa.evaluation.visualization + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.evaluation + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.learner.classifier.rst b/docs/source/capymoa.learner.classifier.rst new file mode 100644 index 00000000..c645582d --- /dev/null +++ b/docs/source/capymoa.learner.classifier.rst @@ -0,0 +1,45 @@ +capymoa.learner.classifier package +================================== + +Submodules +---------- + +capymoa.learner.classifier.CPSSDS module +---------------------------------------- + +.. automodule:: capymoa.learner.classifier.CPSSDS + :members: + :undoc-members: + :show-inheritance: + +capymoa.learner.classifier.OSNN module +-------------------------------------- + +.. automodule:: capymoa.learner.classifier.OSNN + :members: + :undoc-members: + :show-inheritance: + +capymoa.learner.classifier.batch module +--------------------------------------- + +.. automodule:: capymoa.learner.classifier.batch + :members: + :undoc-members: + :show-inheritance: + +capymoa.learner.classifier.classifiers module +--------------------------------------------- + +.. automodule:: capymoa.learner.classifier.classifiers + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.learner.classifier + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.learner.regressor.rst b/docs/source/capymoa.learner.regressor.rst new file mode 100644 index 00000000..0ed6ed45 --- /dev/null +++ b/docs/source/capymoa.learner.regressor.rst @@ -0,0 +1,21 @@ +capymoa.learner.regressor package +================================= + +Submodules +---------- + +capymoa.learner.regressor.regressors module +------------------------------------------- + +.. automodule:: capymoa.learner.regressor.regressors + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.learner.regressor + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.learner.rst b/docs/source/capymoa.learner.rst new file mode 100644 index 00000000..6c71c186 --- /dev/null +++ b/docs/source/capymoa.learner.rst @@ -0,0 +1,30 @@ +Learners +======================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + capymoa.learner.classifier + capymoa.learner.regressor + +Submodules +---------- + +capymoa.learner.learners module +------------------------------- + +.. automodule:: capymoa.learner.learners + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.learner + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.rst b/docs/source/capymoa.rst new file mode 100644 index 00000000..636f23ce --- /dev/null +++ b/docs/source/capymoa.rst @@ -0,0 +1,32 @@ +capymoa package +=============== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + capymoa.datasets + capymoa.evaluation + capymoa.learner + capymoa.stream + +Submodules +---------- + +capymoa.prepare\_jpype module +----------------------------- + +.. automodule:: capymoa.prepare_jpype + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/capymoa.stream.rst b/docs/source/capymoa.stream.rst new file mode 100644 index 00000000..cb21d473 --- /dev/null +++ b/docs/source/capymoa.stream.rst @@ -0,0 +1,21 @@ +Datastreams +====================== + +Submodules +---------- + +capymoa.stream.stream module +---------------------------- + +.. automodule:: capymoa.stream.stream + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: capymoa.stream + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 00000000..2a12f4dc --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,7 @@ +capymoa +======= + +.. toctree:: + :maxdepth: 4 + + capymoa diff --git a/notebooks/DEMO.ipynb b/notebooks/00_getting_started.ipynb similarity index 99% rename from notebooks/DEMO.ipynb rename to notebooks/00_getting_started.ipynb index 67b3f2b9..35a0076e 100644 --- a/notebooks/DEMO.ipynb +++ b/notebooks/00_getting_started.ipynb @@ -6,7 +6,7 @@ "id": "b773bf8e-c420-44e1-80a6-99f75dd12268", "metadata": {}, "source": [ - "## DEMO\n", + "# Getting started\n", "\n", "* Examples on how to use this library for classification and regression, reading files from CSVs and using synthetic generators from MOA.\n", "\n", diff --git a/notebooks/Evaluation_and_Data_Reading.ipynb b/notebooks/01_evaluation_and_data_reading.ipynb similarity index 99% rename from notebooks/Evaluation_and_Data_Reading.ipynb rename to notebooks/01_evaluation_and_data_reading.ipynb index 4bb9dd59..21be0b1e 100644 --- a/notebooks/Evaluation_and_Data_Reading.ipynb +++ b/notebooks/01_evaluation_and_data_reading.ipynb @@ -6,7 +6,7 @@ "id": "223810fd-84a1-40f9-a303-2a64403b49fe", "metadata": {}, "source": [ - "## Testing the Evaluation methods and Data reading\n", + "# Evaluation methods and Data reading\n", "\n", "* Using prequential, test-then-train and windowed evaluation. \n", "* We show how using either CSV or ARFF the API works.\n", @@ -51,7 +51,7 @@ "id": "30fe25b3-25c3-42b4-a09e-7ecd655d7109", "metadata": {}, "source": [ - "# File paths" + "## File paths" ] }, { @@ -85,7 +85,7 @@ "id": "db159a24-78b9-472b-b3f4-78ea04522abe", "metadata": {}, "source": [ - "# Classification evaluation" + "## Classification evaluation" ] }, { @@ -94,7 +94,7 @@ "id": "df79e7d7-bde3-4b59-8479-a44247b3c26f", "metadata": {}, "source": [ - "## 0) [CLASSIFICATION] Reading a stream from a CSV file and using one learner\n", + "### Reading a stream from a CSV file and using one learner\n", "* Uses the ClassificationWindowedEvaluator directly" ] }, @@ -291,7 +291,7 @@ "id": "f7b6994b-b90a-42cd-a37a-0d81f60faba3", "metadata": {}, "source": [ - "## 1) [CLASSIFICATION] Reading from an ARFF file and using 2 learners\n", + "### Reading from an ARFF file and using 2 learners\n", "* Uses the ClassificationEvaluator, thus it uses a cumulative approach for calculating the metrics (not windowed)" ] }, @@ -351,7 +351,7 @@ "id": "99802e5d-c85c-448a-86ca-93910a245666", "metadata": {}, "source": [ - "## 2) [CLASSIFICATION] Reading the data from a CSV, then evaluating it using two learners. \n", + "### Reading the data from a CSV, then evaluating it using two learners. \n", "* **Using the ```prequential_evaluation``` which internally executes both ```ClassificationWindowedEvaluator``` and ```ClassificationEvaluator```**\n", "* ```prequential_evaluation``` allow us to have the windowed and cumulative results. So we can inspect the last accuracy and over time too. \n", "* We also plot the final results using ```plot_windowed_results```" @@ -416,7 +416,7 @@ "id": "041d84a3-aae9-4ad9-b440-a13d6808aeb7", "metadata": {}, "source": [ - "## 3) [CLASSIFICATION] Simple test-then-train evaluation (cumulative). " + "### Simple test-then-train evaluation (cumulative). " ] }, { @@ -457,7 +457,7 @@ "id": "73eba126-2880-464c-a1ec-cdb16dc516da", "metadata": {}, "source": [ - "## 4) [CLASSIFICATION] Simple windowed evaluation" + "### Simple windowed evaluation" ] }, { @@ -499,7 +499,7 @@ "id": "309212f3-8986-482b-88ac-85f862325bfe", "metadata": {}, "source": [ - "## 5) [CLASSIFICATION] Prequential evaluation, single stream, multiple learners. \n", + "### Prequential evaluation, single stream, multiple learners. \n", "* Important: the ```prequential_evaluation_multiple_learners``` iterate through the stream testing and training with each learner\n", "* This method does not calculate ```wallclock``` or ```cpu_time``` because the training and testing of each learner is interleaved" ] @@ -556,7 +556,7 @@ "id": "e43b65ec-4a28-48e9-9020-5b6d0334ce86", "metadata": {}, "source": [ - "## 6) [CLASSIFICATION] prequential_evaluation with a larger stream (100k instances)" + "### prequential_evaluation with a larger stream (100k instances)" ] }, { @@ -615,7 +615,7 @@ "id": "ab1acb93-fb94-437f-ae63-7bc1c732071d", "metadata": {}, "source": [ - "## 7) [CLASSIFICATION] Reading the data from a large CSV\n", + "### Reading the data from a large CSV\n", "* Using the covtFD.csv file with more than 580k instances and 100 features\n" ] }, @@ -684,7 +684,7 @@ "id": "1abf71a5-39a7-4262-bea1-cc7ad0cd4391", "metadata": {}, "source": [ - "# Regression evaluation" + "## Regression evaluation" ] }, { @@ -693,7 +693,7 @@ "id": "120f118c-d8a5-4d10-aad1-a75a2ac122d8", "metadata": {}, "source": [ - "## 0) [REGRESSION] Reading a stream from a CSV file and using one learner\n", + "### Reading a stream from a CSV file and using one learner\n", "* Uses the ```RegressionWindowedEvaluator``` directly" ] }, @@ -888,7 +888,7 @@ "id": "5906e14c-db58-4fe9-90fe-a1765137509f", "metadata": {}, "source": [ - "## 1) [REGRESSION] Reading from an ARFF file and using 2 learners\n", + "### Reading from an ARFF file and using 2 learners\n", "* Uses the RegressionEvaluator, thus it uses a cumulative approach for calculating the metrics (not windowed)" ] }, @@ -948,7 +948,7 @@ "id": "5dd4be58-65bc-45f6-9be5-4ad3effc3ab1", "metadata": {}, "source": [ - "## 2) [REGRESSION] Reading the data from a CSV, then evaluating it using two learners. \n", + "### Reading the data from a CSV, then evaluating it using two learners. \n", "* **Using the ```prequential_evaluation``` which internally executes both ```RegressionWindowedEvaluator``` and ```RegressionEvaluator```**\n", "* ```prequential_evaluation``` allow us to have the windowed and cumulative results. So we can inspect the last accuracy and over time too. \n", "* We also plot the final results using ```plot_windowed_results```" @@ -1013,7 +1013,7 @@ "id": "410145fa-5203-4c79-b86f-8ce891691751", "metadata": {}, "source": [ - "## 4) [REGRESSION] Simple test-then-train evaluation (cumulative). " + "### Simple test-then-train evaluation (cumulative). " ] }, { @@ -1054,7 +1054,7 @@ "id": "96ffc568-8502-42e7-9768-a368ddc3c3f8", "metadata": {}, "source": [ - "## 5) [REGRESSION] Prequential evaluation, single stream, multiple learners. \n", + "### Prequential evaluation, single stream, multiple learners. \n", "* Important: the ```prequential_evaluation_multiple_learners``` iterate through the stream testing and training with each learner\n", "* This method does not calculate ```wallclock``` or ```cpu_time``` because the training and testing of each learner is interleaved" ] diff --git a/notebooks/MOALearners_API_Examples.ipynb b/notebooks/02_learners_api_examples.ipynb similarity index 99% rename from notebooks/MOALearners_API_Examples.ipynb rename to notebooks/02_learners_api_examples.ipynb index 88b599c3..dec4bdaf 100644 --- a/notebooks/MOALearners_API_Examples.ipynb +++ b/notebooks/02_learners_api_examples.ipynb @@ -6,16 +6,16 @@ "id": "e74571ce-e81a-4321-a8f8-c7a9fe7b851a", "metadata": {}, "source": [ - "# Experimenting with several learners APIs for classification and regression\n", + "# Learners API Examples\n", "\n", "* ```MOAClassifier``` and ```MOARegressor```\n", "* ```AdaptiveRandomForest```, ```OnlineBagging``` and ```AdaptiveRandomForestRegressor```\n", "* ```ClassificationEvaluator```, ```ClassificationWindowedEvaluator```, ```RegressionEvaluator``` and ```RegressionWindowedEvaluator```\n", "\n", - "Some comments: \n", + "Some comments:\n", + "\n", "* We can use the ```MOAClassifier``` and ```MOARegressor``` to execute any MOA classifier and regressor, respectively.\n", - "* We can create wrappers for each class, like the AdaptiveRandomForest wrapper. Using an alias in here as we don't want to conflict with the MOA AdaptiveRandomForest. \n", - "```from classifiers import AdaptiveRandomForest as ARF```\n", + "* We can create wrappers for each class, like the AdaptiveRandomForest wrapper. Using an alias in here as we don't want to conflict with the MOA AdaptiveRandomForest. ```from classifiers import AdaptiveRandomForest as ARF```\n", "\n", "**Notebook last update: 17/02/2024**" ] diff --git a/notebooks/Using_sklearn_pytorch.ipynb b/notebooks/03_using_sklearn_pytorch.ipynb similarity index 99% rename from notebooks/Using_sklearn_pytorch.ipynb rename to notebooks/03_using_sklearn_pytorch.ipynb index f544d829..99291202 100644 --- a/notebooks/Using_sklearn_pytorch.ipynb +++ b/notebooks/03_using_sklearn_pytorch.ipynb @@ -6,7 +6,7 @@ "id": "b773bf8e-c420-44e1-80a6-99f75dd12268", "metadata": {}, "source": [ - "## Using sklearn and pytorch\n", + "# Using sklearn and pytorch\n", "\n", "* Demonstrate how someone can directly use sklearn learners or pytorch in CapyMOA.\n", "* Ideally, one should be free to use other learners\n", diff --git a/notebooks/DriftStream_API.ipynb b/notebooks/04_drift_streams.ipynb similarity index 99% rename from notebooks/DriftStream_API.ipynb rename to notebooks/04_drift_streams.ipynb index 9250cad6..23302d1a 100644 --- a/notebooks/DriftStream_API.ipynb +++ b/notebooks/04_drift_streams.ipynb @@ -1,11 +1,12 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "48637040-3764-4a73-8e79-642fc1f9db09", "metadata": {}, "source": [ - "## DriftStream API\n", + "# DriftStream API\n", "\n", "* How to use the DriftStream API in CapyMOA\n", "* There are two proposals, one of which has been implemented already\n", @@ -39,11 +40,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "19caafb9-2279-46ca-b12e-d92943af99b1", "metadata": {}, "source": [ - "# 1. Creating a synthetic stream with concept drifts from MOA\n", + "## 1. Creating a synthetic stream with concept drifts from MOA\n", "\n", "* Demonstrates the flexibility of the API, these level of manipulation of the API is expected from experienced MOA users.\n", "* To use the API like this the user must be familiar with how concept drifts are simulatd in MOA\n", @@ -88,11 +90,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b295e120-8050-48a3-93b5-39efc295102b", "metadata": {}, "source": [ - "## 1.1 CapyMOA wrapper for MOA synthetic generators\n", + "### 1.1 CapyMOA wrapper for MOA synthetic generators\n", "\n", "* This is just an example on how to use a wrapper from CapyMOA" ] @@ -301,19 +304,12 @@ ] }, { - "cell_type": "markdown", - "id": "6af25914-2e9a-401c-961c-174d9f5cffc2", - "metadata": {}, - "source": [ - "### " - ] - }, - { + "attachments": {}, "cell_type": "markdown", "id": "7f233c22-d543-4606-b175-08a76040d6cf", "metadata": {}, "source": [ - "### 2.2.1 Obtaining meta-data about drift from a MOA Stream\n", + "#### 2.2.1 Obtaining meta-data about drift from a MOA Stream\n", "\n", "* Besides composing a drifting stream, the DriftStream object also holds information about the Drifts. \n", "* The meta-data about the drifts can be used for calculating concept drift statistics (i.e. metrics to calculate drift detection performance)" diff --git a/pyproject.toml b/pyproject.toml index 5324b2bd..bdb8c987 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,12 @@ dev=[ "pytest-xdist" ] +doc=[ + "sphinx", + "sphinx-rtd-theme", + "nbsphinx" +] + [tool.pytest.ini_options] addopts = ["--import-mode=importlib"] pythonpath = [