Package: keras-autodoc
keras-autodocAutodocformkdocs.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 thedocumentation!Installpipinstallkeras-autodocWe recommend pinning the version (eg:pip install keras-autodoc==0.3.2). We may break compatibility without any warning.ExampleLet's suppose that you have adocsdirectory:./docs
|-- autogen.py
|-- mkdocs.ymlThe API is quite simple:# content of docs/autogen.pyfromkeras_autodocimportDocumentationGeneratorpages={'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.ymlsite_name:My_sitedocs_dir:sourcessite_description:'Myprettysite.'nav:-Core:layers/core.md-Callbacks:-Some callbacks:callbacks.mdThen you just have to run:pythonautogen.py
mkdocsserveand you'll be able to see your website atlocalhost:8000/callbacks.Docstring format:The docstrings used should use the The docstrings follow theGoogle Python Style Guidewith markdown, or just plain markdown.For example, let's take this class:classImageDataGenerator:"""Generate batches of tensor image data with real-time data augmentation.The data will be looped over (in batches).# Argumentsfeaturewise_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 valuesare integers `[-1, 0, +1]`,same as with `width_shift_range=[-1, 0, +1]`,while with `width_shift_range=1.0` possible values are floatsin the interval `[-1.0, +1.0)`.# ExamplesExample of using `.flow(x, y)`:```pythondatagen = 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):passwill 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).Argumentsfeaturewise_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 intfloat: 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)Withwidth_shift_range=2possible values
are integers[-1, 0, +1],
same as withwidth_shift_range=[-1, 0, +1],
while withwidth_shift_range=1.0possible values are floats
in the interval[-1.0, +1.0).ExamplesExample 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 docsIf you want examples, you can take a look atthe docs directory of autokerasas well asthe generated docs.You can also look atthe docs directory of keras-tuner.