Block

[source]

ConvBlock class

autokeras.ConvBlock(
    kernel_size=None,
    num_blocks=None,
    num_layers=None,
    max_pooling=None,
    separable=None,
    dropout_rate=None,
    **kwargs
)

Block for vanilla ConvNets.

Arguments

  • kernel_size: Int. If left unspecified, it will be tuned automatically.
  • num_blocks: Int. The number of conv blocks, each of which may contain convolutional, max pooling, dropout, and activation. If left unspecified, it will be tuned automatically.
  • num_layers: Int. The number of convolutional layers in each block. If left unspecified, it will be tuned automatically.
  • max_pooling: Boolean. Whether to use max pooling layer in each block. If left unspecified, it will be tuned automatically.
  • separable: Boolean. Whether to use separable conv layers. If left unspecified, it will be tuned automatically.
  • dropout_rate: Float. Between 0 and 1. The dropout rate for after the convolutional layers. If left unspecified, it will be tuned automatically.

[source]

DenseBlock class

autokeras.DenseBlock(num_layers=None, use_batchnorm=None, dropout_rate=None, **kwargs)

Block for Dense layers.

Arguments

  • num_layers: Int. The number of Dense layers in the block. If left unspecified, it will be tuned automatically.
  • use_bn: Boolean. Whether to use BatchNormalization layers. If left unspecified, it will be tuned automatically.
  • dropout_rate: Float. The dropout rate for the layers. If left unspecified, it will be tuned automatically.

[source]

Embedding class

autokeras.Embedding(
    max_features=20000, pretraining=None, embedding_dim=None, dropout_rate=None, **kwargs
)

Word embedding block for sequences.

The input should be tokenized sequences with the same length, where each element of a sequence should be the index of the word.

Arguments

  • max_features: Int. Size of the vocabulary. Must be set if not using TextToIntSequence before this block. Defaults to 20000.
  • pretraining: String. 'random' (use random weights instead any pretrained model), 'glove', 'fasttext' or 'word2vec'. Use pretrained word embedding. If left unspecified, it will be tuned automatically.
  • embedding_dim: Int. If left unspecified, it will be tuned automatically.
  • dropout_rate: Float. The dropout rate for after the Embedding layer. If left unspecified, it will be tuned automatically.

[source]

Merge class

autokeras.Merge(merge_type=None, **kwargs)

Merge block to merge multiple nodes into one.

Arguments

  • merge_type: String. 'add' or 'concatenate'. If left unspecified, it will be tuned automatically.

[source]

ResNetBlock class

autokeras.ResNetBlock(version: str = None, pooling: str = None, **kwargs)

Block for ResNet.

Arguments

  • version: String. 'v1', 'v2' or 'next'. The type of ResNet to use. If left unspecified, it will be tuned automatically.
  • pooling: String. 'avg', 'max'. The type of pooling layer to use. If left unspecified, it will be tuned automatically.

[source]

RNNBlock class

autokeras.RNNBlock(
    return_sequences: bool = False,
    bidirectional: Optional[bool] = None,
    num_layers: Optional[int] = None,
    layer_type: Optional[int] = None,
    **kwargs
)

An RNN Block.

Arguments

  • return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence. Defaults to False.
  • bidirectional: Boolean. Bidirectional RNN. If left unspecified, it will be tuned automatically.
  • num_layers: Int. The number of layers in RNN. If left unspecified, it will be tuned automatically.
  • layer_type: String. 'gru' or 'lstm'. If left unspecified, it will be tuned automatically.

[source]

SpatialReduction class

autokeras.SpatialReduction(reduction_type: Optional[str] = None, **kwargs)

Reduce the dimension of a spatial tensor, e.g. image, to a vector.

Arguments

  • reduction_type: String. 'flatten', 'global_max' or 'global_avg'. If left unspecified, it will be tuned automatically.

[source]

TemporalReduction class

autokeras.TemporalReduction(reduction_type=None, **kwargs)

Reduce the dimension of a temporal tensor, e.g. output of RNN, to a vector.

Arguments

  • reduction_type: String. 'flatten', 'global_max' or 'global_avg'. If left unspecified, it will be tuned automatically.

[source]

XceptionBlock class

autokeras.XceptionBlock(
    activation=None, initial_strides=None, num_residual_blocks=None, pooling=None, **kwargs
)

XceptionBlock.

An Xception structure, used for specifying your model with specific datasets.

The original Xception architecture is from https://arxiv.org/abs/1610.02357. The data first goes through the entry flow, then through the middle flow which is repeated eight times, and finally through the exit flow.

This XceptionBlock returns a similar architecture as Xception except without the last (optional) fully connected layer(s) and logistic regression. The size of this architecture could be decided by HyperParameters, to get an architecture with a half, an identical, or a double size of the original one.

Arguments

  • activation: String. 'selu' or 'relu'. If left unspecified, it will be tuned automatically.
  • initial_strides: Int. If left unspecified, it will be tuned automatically.
  • num_residual_blocks: Int. If left unspecified, it will be tuned automatically.
  • pooling: String. 'ave', 'flatten', or 'max'. If left unspecified, it will be tuned automatically.

[source]

ImageBlock class

autokeras.ImageBlock(block_type=None, normalize=None, augment=None, **kwargs)

Block for image data.

The image blocks is a block choosing from ResNetBlock, XceptionBlock, ConvBlock, which is controlled by a hyperparameter, 'block_type'.

Arguments

  • block_type: String. 'resnet', 'xception', 'vanilla'. The type of Block to use. If unspecified, it will be tuned automatically.
  • normalize: Boolean. Whether to channel-wise normalize the images. If unspecified, it will be tuned automatically.
  • augment: Boolean. Whether to do image augmentation. If unspecified, it will be tuned automatically.

[source]

StructuredDataBlock class

autokeras.StructuredDataBlock(categorical_encoding=True, seed=None, **kwargs)

Block for structured data.

Arguments

  • categorical_encoding: Boolean. Whether to use the CategoricalToNumerical to encode the categorical features to numerical features. Defaults to True. If specified as None, it will be tuned automatically.
  • seed: Int. Random seed.

[source]

TextBlock class

autokeras.TextBlock(vectorizer=None, pretraining=None, **kwargs)

Block for text data.

Arguments

  • vectorizer: String. 'sequence' or 'ngram'. If it is 'sequence', TextToIntSequence will be used. If it is 'ngram', TextToNgramVector will be used. If unspecified, it will be tuned automatically.
  • pretraining: String. 'random' (use random weights instead any pretrained model), 'glove', 'fasttext' or 'word2vec'. Use pretrained word embedding. If left unspecified, it will be tuned automatically.