Skip to main content

Building the Keras projects docs.

Project description

keras-autodoc

Autodoc for mkdocs.

keras-autodoc will fetch the docstrings from the functions you wish to document and will insert them in the markdown files.

Take a look at the documentation!

Install

pip install keras-autodoc

We recommend pinning the version (eg: pip install keras-autodoc==0.3.2). We may break compatibility without any warning.

Example

Let's suppose that you have a docs directory:

./docs
|-- autogen.py
|-- mkdocs.yml

The API is quite simple:

# content of docs/autogen.py

from keras_autodoc import DocumentationGenerator


pages = {'layers/core.md': ['keras.layers.Dense', 'keras.layers.Flatten'],
         'callbacks.md': ['keras.callbacks.TensorBoard']}

doc_generator = DocumentationGenerator(pages)
doc_generator.generate('./sources')
# content of docs/mkdocs.yml

site_name: My_site
docs_dir: sources
site_description: 'My pretty site.'

nav:
    - Core: layers/core.md
    - Callbacks:
      - Some callbacks: callbacks.md

Then you just have to run:

python autogen.py
mkdocs serve

and you'll be able to see your website at localhost:8000/callbacks.

Docstring format:

The docstrings used should use the The docstrings follow the Google Python Style Guide with markdown, or just plain markdown.

For example, let's take this class:

class ImageDataGenerator:
    """Generate batches of tensor image data with real-time data augmentation.

    The data will be looped over (in batches).

    # Arguments
        featurewise_center: Boolean.
            Set input mean to 0 over the dataset, feature-wise.
        zca_whitening: Boolean. Apply ZCA whitening.
        width_shift_range: Float, 1-D array-like or int
            - float: fraction of total width, if < 1, or pixels if >= 1.
            - 1-D array-like: random elements from the array.
            - int: integer number of pixels from interval
                `(-width_shift_range, +width_shift_range)`
            - With `width_shift_range=2` possible values
                are integers `[-1, 0, +1]`,
                same as with `width_shift_range=[-1, 0, +1]`,
                while with `width_shift_range=1.0` possible values are floats
                in the interval `[-1.0, +1.0)`.

    # Examples

    Example of using `.flow(x, y)`:
    ```python
    datagen = ImageDataGenerator(
        featurewise_center=True,
        zca_whitening=True,
        width_shift_range=0.2)
    # compute quantities required for featurewise normalization
    # (std, mean, and principal components if ZCA whitening is applied)
    datagen.fit(x_train)
    # fits the model on batches with real-time data augmentation:
    model.fit_generator(datagen.flow(x_train, y_train, batch_size=32),
                        steps_per_epoch=len(x_train) / 32, epochs=epochs)
    ```
    """

    def __init__(self,featurewise_center, zca_whitening, width_shift_range):
        pass

will be rendered as:

ImageDataGenerator class:

dummy_module.ImageDataGenerator(featurewise_center, zca_whitening, width_shift_range=0.0)

Generate batches of tensor image data with real-time data augmentation.

The data will be looped over (in batches).

Arguments

  • featurewise_center: Boolean. Set input mean to 0 over the dataset, feature-wise.
  • zca_whitening: Boolean. Apply ZCA whitening.
  • width_shift_range: Float, 1-D array-like or int
    • float: fraction of total width, if < 1, or pixels if >= 1.
    • 1-D array-like: random elements from the array.
    • int: integer number of pixels from interval (-width_shift_range, +width_shift_range)
    • With width_shift_range=2 possible values are integers [-1, 0, +1], same as with width_shift_range=[-1, 0, +1], while with width_shift_range=1.0 possible values are floats in the interval [-1.0, +1.0).

Examples

Example of using .flow(x, y):

datagen = ImageDataGenerator(
    featurewise_center=True,
    zca_whitening=True,
    width_shift_range=0.2)
# compute quantities required for featurewise normalization
# (std, mean, and principal components if ZCA whitening is applied)
datagen.fit(x_train)
# fits the model on batches with real-time data augmentation:
model.fit_generator(datagen.flow(x_train, y_train, batch_size=32),
                    steps_per_epoch=len(x_train) / 32, epochs=epochs)

Take a look at our docs

If you want examples, you can take a look at the docs directory of autokeras as well as the generated docs.

You can also look at the docs directory of keras-tuner.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keras-autodoc-0.5.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

keras_autodoc-0.5.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file keras-autodoc-0.5.0.tar.gz.

File metadata

  • Download URL: keras-autodoc-0.5.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for keras-autodoc-0.5.0.tar.gz
Algorithm Hash digest
SHA256 69449805e4da1c6a199000ee46cf863eacc3e8c8a55b7a81dd28509820e1cd85
MD5 8d675a8842b083fc2a91f6bfa817a8e1
BLAKE2b-256 824e9f4bbce532b304a1ace7e50732c4a8cd4b550ed92782a1992fd39b3bb0c7

See more details on using hashes here.

Provenance

File details

Details for the file keras_autodoc-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: keras_autodoc-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for keras_autodoc-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e76f4b99a5034fdb1172c0f1bdf761609446a73fece69f866fb047fd2e894635
MD5 88167eb53d052ff8b31d85c855f6d3ca
BLAKE2b-256 fb49b1822dd987f712e3651d189b93db7e841f0db420da6ec75fc488161863ed

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page