from keras.datasets import mnist
from autokeras.image_supervised import ImageClassifier
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape + (1,))
x_test = x_test.reshape(x_test.shape + (1,))
clf = ImageClassifier(verbose=True)
clf.fit(x_train, y_train, time_limit=12 * 60 * 60)
clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)
y = clf.evaluate(x_test, y_test)
print(y)
Steps to reproduce the behavior:
Include the details about the versions of:
Hey,
I get pretty much the same issue with the first example on MacOSX 10.12
I installed autokeras via a pip3 install autokerasand my python version is a fresh 3.6 from python.org
When I try to run the very first example I get this error:
Traceback (most recent call last):
File "autokeras.py", line 1, in <module>
import autokeras as ak
File "/Users/julien/travail/python/autokeras.py", line 3, in <module>
clf = ak.ImageClassifier()
AttributeError: module 'autokeras' has no attribute 'ImageClassifier'
@jrenouard
Thank you for your report but we really cannot reproduce the error.
Would you use "python3 -m pip install autokeras" to install, and use "python3" to run the mnist.py?
So that it can make sure the package is installed for the same interpreter you use to run the script.
Thanks.
I followed your steps but still getting the same eroor
I'm getting the same error AttributeError: module 'autokeras' has no attribute 'ImageClassifier' on Ubuntu 18.04.
On Windows 10 it works just fine.
I tried pip3 install autokeras and python3 -m pip install autokeras.
But in Mac it is still showing error
hi @albert-92 @abhisingh007224 , I really cannot reproduce this error. Maybe it is related to the conda environment?
Would you please run the following script with the same python interpreter and paste the output here?
Thank you for your help!
import sys
print(sys.version)
import pkg_resources
pkg_resources.get_distribution("autokeras").version
import autokeras
print(autokeras.__dict__)
I had this problem and found out that my file was named autokeras.py, so when I imported the lib, I was actually importing my own file. Changing the file name solved the problem.
Most helpful comment
I had this problem and found out that my file was named autokeras.py, so when I imported the lib, I was actually importing my own file. Changing the file name solved the problem.