{ "cells": [ { "cell_type": "markdown", "source": [ "# Overview of the base class structure\n", "\n", "`aeon` uses a core inheritance hierarchy of classes across the toolkit, with\n", "specialised sub classes in each module. The basic class hierarchy is summarised in\n", "the following simplified UML\n", "\n", "\"Basic\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## sklearn `BaseEstimator` and aeon `BaseObject`\n", "\n", "To make sense of this, we break it down from the top.\n", "\n", "\"Top\n", "\n", "Everything inherits from sklearns `BaseEstimator`. This handles the mechanisms for\n", "getting and setting parameters. The code structure below is stylised to show the\n", "main functionality and may differ in details from the actual implementations.\n", "\n", "\"sklearn\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "The aeon class `BaseObject` extends `BaseEstimator` and adds the tagging method and\n", "some other functionality used in `aeon` estimators\n", "\n", "\"Base\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## aeons ``BaseEstimator``, `BaseDeepNetwork` and `BaseMetric`\n", "\n", "Three classes extend `BaseObject`: ``BaseEstimator``, `BaseDeepNetwork` and\n", "`BaseMetric`.\n", "\n", "`BaseDeepNetwork` is the base class for all the deep learning networks defined in the\n", "`networks` module. It has a single abstract method `build_network`.\n", "\n", "\"Base\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "The `BaseMetric` class is the base class for forecasting performance metrics. It has\n", "a single abstract method `evaluate`.\n", "\n", "\"Base\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "The ``BaseEstimator`` class is the base class for the majority of classes in aeon.\n", "Anything that uses fit and predict in aeon. It contains a protected attribute\n", "`_is_fitted` and checks as to the value of this attribute. It also has a method to\n", "get fitted parameters.\n", "\n", "\"Base" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "`BaseEstimator` has four direct base classes: `BaseForecaster`,\n", "`BaseSeriesAnnotator`, `BaseTransformer` and `BaseCollectionEstimator`.\n", "\n", "\n", "\"Top" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseForecaster` (aeon.forecasting.base)\n", "contains the forecasting specific methods. More details are available in the [API](https://www.aeon-toolkit.org/en/latest/api_reference/forecasting.html). `BaseForecaster` has the following concrete methods:\n", "\n", "\"Base" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseSeriesAnnotator` (aeon.annotation.base)\n", "\n", "is a largely experimental base class for use with annotators that implement\n", "techniques for segmentation and anomaly detection. It has two public attributes: `fmt`\n", " and `labels`, and public methods as follows:\n", "\n", "\"Base" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseTransformer` (aeon.transformations.base)\n", "\n", "Is the base class for all transformers, including single series transformers and\n", "collections transformers.\n", "\n", "\"Base\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseCollectionEstimator` (aeon.base)\n", "\n", "Is the base class for estimators that construct models on collections of time series.\n", " This includes classifiers, clusterers, regressors and collection transformers. It\n", " contains attributes and tags common to all these estimators, and protected methods\n", " to perform checks and preprocessing common to all these estimators.\n", "\n", "\"Base\n"," ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "The subclasses of `BaseCollectionEstimator` are as follows\n", "\n", "\"Top\n", "\n", "they have similar interfaces, but they are not identical\n", "\n", "## `BaseClassifier` (aeon.classification)\n", "\n", "This is the base class for all classifiers. It uses the standard `fit`, `predict` and\n", " `predict_proba` structure from `sklearn`. `fit` and\n", " `predict` call the abstract methods `_fit` and `_predict` which are implemented in\n", " the subclass to define the classification algorithm. All of the common format checking\n", " and conversion is done using the following final methods defined in\n", " `BaseCollectionEstimator`.\n", "\n", "\"Top" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseRegressor` (aeon.regression)\n", "\n", "BaseRegressor has the same structure as `BaseClassifier`, although it has no\n", "`predict_proba` method. The tests on y are also different.\n", "\n", "\n", "\"Top" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseClusterer` (aeon.clustering)\n", "\n", "`BaseClusterer` also has `fit` and `predict`, but does not take input y. It does\n", "include `predict_proba`.\n", "\n", "\n", "\"Base\n"," ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## `BaseCollectionTransformer` (aeon.transformations.collection)\n", "\n", "The `BaseCollectionTransformer` was introduced to differentiate transformers that\n", "work on a single series to those that work on collections. Part of the motivation was\n", " to work around a lot of legacy code in `BaseTransformer` that performs a huge amount\n", " of conversion checks that is unnecessary for collections. Rather than `fit` and\n", " `predict` it implements `fit`, `transform` and `fit_transform`.\n", "\n", "\n", "\"Base\n",\n" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [], "metadata": { "collapsed": false } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }