.. _api:

API Reference
=============

.. automodule:: vak
.. currentmodule:: vak

This section documents the vak `API <https://en.wikipedia.org/wiki/API>`_.

Command Line Interface
----------------------

The :mod:`vak.cli` module implements the vak command line interface.

.. autosummary::
   :toctree: generated
   :template: module.rst

   cli.cli
   cli.eval
   cli.learncurve
   cli.predict
   cli.prep
   cli.train

Commands
--------

These high-level functions correspond to commands in the
commmand-line interface. The commands are to prepare datasets,
train and evaluate models, and generate predictions from trained models.

Prep
~~~~

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   prep
   prep.frame_classification
   prep.parametric_umap
   prep.spectrogram_dataset
   prep.unit_dataset
   prep.audio_dataset
   prep.constants
   prep.dataset_df_helper
   prep.prep_
   prep.sequence_dataset

Train-test-validation splits of datasets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :mod:`vak.split` module contains functionality
for generating train-validation-test splits from
datasets. It is called by the :mod:`vak.prep` function
when running ``vak prep`` through the command line interface.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   prep.split.algorithms.bruteforce
   prep.split.algorithms.validate
   prep.split.split


Train
~~~~~

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   train.train_
   train.frame_classification
   train.parametric_umap

Eval
~~~~

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   eval.eval_
   eval.frame_classification
   eval.parametric_umap

Predict
~~~~~~~

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   predict.predict_
   predict.frame_classification
   predict.parametric_umap

Learning Curve
~~~~~~~~~~~~~~

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   learncurve.curvefit
   learncurve.dirname
   learncurve.frame_classification
   learncurve.learncurve

Configuration files
-------------------

The :mod:`vak.config` module contains functions to parse
the TOML configuration files used with vak,
and dataclasses that represent tables from those files.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   config.config
   config.dataset
   config.eval
   config.learncurve
   config.load
   config.model
   config.predict
   config.prep
   config.spect_params
   config.train
   config.trainer
   config.validators

Datasets
--------
The :mod:`vak.datasets` module contains datasets built into vak.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   datasets.frame_classification
   datasets.parametric_umap

Datapipes
---------

The :mod:`vak.datapipes` module contains datapipes for loading dataset
generated by :func:`vak.prep.prep`.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   datapipes.frame_classification
   datapipes.parametric_umap

Metrics
-------
The :mod:`vak.metrics` module contains metrics used
when evaluating neural network model performance.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   metrics.classification.classification
   metrics.classification.functional
   metrics.distance.distance
   metrics.distance.functional

Models
-------
The :mod:`vak.models` module contains models
built into vak, and functions for working with models:
declaring them via definition, registering them
as one of a family of models, getting a model instance
for training, predicting, etc.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   models.base
   models.convencoder_umap
   models.decorator
   models.definition
   models.ed_tcn
   models.frame_classification_model
   models.get
   models.parametric_umap_model
   models.registry
   models.tweetynet

Nets
----
The :mod:`vak.nets` module contains
neural network architectures built into vak.
All models include a neural network architecture
(along with an optimizer, loss function, and metrics).

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   nets.conv_encoder
   nets.ed_tcn
   nets.tweetynet

Neural Network Layers and Operations
------------------------------------
The :mod:`vak.nn` module contains
operations, layers, and other graph components
used in neural network architectures.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   nn.loss
   nn.functional

Plotting
--------

Functions for plotting
that are built in to vak live in the :mod:`vak.plot` module.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   plot.annot
   plot.learncurve
   plot.spect

Transforms
----------

The :mod:`vak.transforms` module contains transforms
that can be applied to input or output of neural networks,
i.e., for pre-processing or post-processing.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   transforms.defaults
   transforms.frame_labels.functional
   transforms.frame_labels.transforms
   transforms.functional
   transforms.transforms

Common
------

This module contains helper functions
used by multiple other modules.

.. autosummary::
   :toctree: generated
   :template: module.rst
   :recursive:

   common.accelerator
   common.annotation
   common.constants
   common.converters
   common.files
   common.labels
   common.learncurve
   common.logging
   common.paths
   common.tensorboard
   common.timebins
   common.timenow
   common.trainer
   common.typing
   common.validators
