Created
September 14, 2019 12:46
-
-
Save LetticiaNicoli/d43d1270b3ddec4391171576c7011483 to your computer and use it in GitHub Desktop.
AutoKeras Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!pip install autokeras | |
!pip install keras | |
from keras.datasets import mnist | |
from autokeras.image.image_supervised import ImageClassifier | |
# loadning fashion-mnist from keras | |
(X_train, y_train), (X_test, y_test) = fashion_mnist.load_data() | |
X_train = X_train.reshape(X_train.shape + (1,)) | |
X_test = X_test.reshape(X_test.shape + (1,)) | |
# initialize the classifier | |
# data augmentation set to True | |
clf_augmented = ImageClassifier(verbose=True, augment=True) | |
# fit the classifier to the dataset | |
# nb!: default time limit is 24 h! | |
# for this example 1 h should be enough | |
clf_augmented.fit(X_train, y_train, time_limit=(1*60*60)) | |
clf_augmented.final_fit(X_train, y_train, X_test, y_test, retrain=False) | |
y_pred_augmented = clf_augmented.evaluate(X_test, y_test) | |
print(y_pred_augmented) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment