Base Classes


Node class


The nodes in a network connecting the blocks.


Preprocessor class

autokeras.Preprocessor(name=None, **kwargs)

Hyper preprocessing block base class.

It extends Block which extends Hypermodel. A preprocessor is a Hypermodel, which means it is a search space. However, different from other Hypermodels, it is also a model which can be fit.


Block class

autokeras.Block(name=None, **kwargs)

The base class for different Block.

The Block can be connected together to build the search space for an AutoModel. Notably, many args in the init function are defaults to be a tunable variable when not specified by the user.


  • name: String. The name of the block. If unspecified, it will be set

automatically with the class name.


build method, inputs=None)

Build the Block into a real Keras Model.

The subclasses should override this function and return the output node.


  • hp: HyperParameters. The hyperparameters for building the model.
  • inputs: A list of input node(s).


Head class

autokeras.Head(loss=None, metrics=None, output_shape=None, **kwargs)

Base class for the heads, e.g. classification, regression.


  • loss: A Keras loss function. Defaults to None. If None, the loss will be inferred from the AutoModel.
  • metrics: A list of Keras metrics. Defaults to None. If None, the metrics will be inferred from the AutoModel.
  • output_shape: Tuple of int(s). Defaults to None. If None, the output shape will be inferred from the AutoModel.