predict: Model Predictions

Description Usage Arguments Value Examples

Description

Predict the output for a given testing data.

Usage

1
2
## S3 method for class 'AutokerasModel'
predict(object, x, batch_size = 32, ...)

Arguments

object

: A trained AutokerasModel instance.

x

: Any allowed types according to the input node. Testing data. Check corresponding AutokerasModel help to note how it should be provided.

batch_size

: numeric. Defaults to '32'.

...

: Unused.

Value

A one-column matrix with the predicted values as rows.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
library("keras")

# use the MNIST dataset as an example
mnist <- dataset_mnist()
c(x_train, y_train) %<-% mnist$train
c(x_test, y_test) %<-% mnist$test

library("autokeras")

# Initialize the image classifier
clf <- model_image_classifier(max_trials = 10) %>% # It tries 10 different models
  fit(x_train, y_train) # Feed the image classifier with training data

# Predict with the best model
(predicted_y <- clf %>% predict(x_test))

# Evaluate the best model with testing data
clf %>% evaluate(x_test, y_test)

# Get the best trained Keras model, to work with the keras R library
export_model(clf)

## End(Not run)

autokeras documentation built on Jan. 17, 2021, 9:06 a.m.