跳转到主要内容

构建Keras项目文档。

项目描述

keras-autodoc

Autodoc for mkdocs.

keras-autodoc将从您希望文档化的函数中提取文档字符串,并将它们插入到Markdown文件中。

查看文档

安装

pip install keras-autodoc

我们建议固定版本(例如:pip install keras-autodoc==0.3.2)。我们可能会在不警告的情况下破坏兼容性。

示例

假设您有一个docs目录

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

API非常简单

# 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

然后你只需运行

python autogen.py
mkdocs serve

你就可以在 localhost:8000/callbacks 上看到你的网站了。

文档字符串格式

使用的文档字符串应遵循 Google Python 编程风格指南 中的 markdown 格式,或者直接使用纯 markdown 格式。

例如,让我们以这个类为例

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

将渲染为

ImageDataGenerator 类

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

使用实时数据增强生成批次的张量图像数据。

数据将循环遍历(以批量的形式)。

参数

  • featurewise_center:布尔值。将输入数据的均值设置为 0,特征维度。
  • zca_whitening:布尔值。应用 ZCA 白化。
  • width_shift_range:浮点数,1-D 数组或整数
    • 浮点数:总宽度的分数,如果小于 1,或像素数,如果大于等于 1。
    • 1-D 数组:从数组中随机选择的元素。
    • 整数:从区间 (-width_shift_range, +width_shift_range) 中随机选择的像素数。
    • width_shift_range=2 时,可能的值为整数 [-1, 0, +1],与 width_shift_range=[-1, 0, +1] 相同,而 width_shift_range=1.0 时可能的值为区间 [-1.0, +1.0) 中的浮点数。

示例

使用 .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)

查看我们的文档

如果您想查看示例,可以查看 autokeras 的文档目录 以及 生成的文档

您还可以查看 keras-tuner 的文档目录

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪一个,请了解有关 安装包 的更多信息。

源分布

keras-autodoc-0.8.0.tar.gz (27.6 kB 查看哈希值)

上传时间

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面