构建Keras项目文档。
项目描述
keras-autodoc
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 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f31b9f757119ccd15570c5ff0f36479af26e3d1959dc655c16d82e8ca0f2d231 |
|
MD5 | 2b16d95ebde4ec30cbe152da3e7cce18 |
|
BLAKE2b-256 | 8efca9fe8eef7793c96da2b097745534e1f0d719e01ea548ef840b08bd924d89 |