autokeras.auto_model.GraphAutoModel(inputs, outputs, name='graph_auto_model', max_trials=100, directory=None, seed=None)
A HyperModel defined by a graph of HyperBlocks.
GraphAutoModel is a subclass of HyperModel. Besides the HyperModel properties,
it also has a tuner to tune the HyperModel. The user can use it in a similar
way to a Keras model since it also has
The user can specify the high-level neural architecture by connecting the HyperBlocks with the functional API, which is the same as the Keras functional API.
- inputs: A list of or a HyperNode instances. The input node(s) of the GraphAutoModel.
- outputs: A list of or a HyperNode instances. The output node(s) of the GraphAutoModel.
- name: String. The name of the AutoModel. Defaults to 'graph_auto_model'.
- max_trials: Int. The maximum number of different Keras Models to try. The search may finish before reaching the max_trials. Defaults to 100.
- directory: String. The path to a directory for storing the search outputs. Defaults to None, which would create a folder with the name of the AutoModel in the current directory.
- seed: Int. Random seed.
fit(x=None, y=None, validation_split=0, validation_data=None)
Search for the best model and hyperparameters for the AutoModel.
It will search for the best model based on the performances on validation data.
- x: numpy.ndarray or tensorflow.Dataset. Training data x.
- y: numpy.ndarray or tensorflow.Dataset. Training data y.
- validation_split: Float between 0 and 1.
Fraction of the training data to be used as validation data.
The model will set apart this fraction of the training data,
will not train on it, and will evaluate
the loss and any model metrics
on this data at the end of each epoch.
The validation data is selected from the last samples
ydata provided, before shuffling. This argument is not supported when
xis a dataset.
validation_data: Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data.
(x_val, y_val)of Numpy arrays or tensors
(x_val, y_val, val_sample_weights)of Numpy arrays
- dataset or a dataset iterator
For the first two cases,
batch_sizemust be provided. For the last case,
validation_stepsmust be provided.
**kwargs: Any arguments supported by keras.Model.fit.
Predict the output for a given testing data.
- x: tf.data.Dataset or numpy.ndarray. Testing data.
- batch_size: Int. Defaults to 32.
- **kwargs: Any arguments supported by keras.Model.predict.