I tried to run auto-keras in a demo, but it failed, the code as shown below:
from keras.datasets import mnist
from autokeras.classifier 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)
```
The error message as shown below:
```
Initializing search.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-23-077a1b1d90e1> in <module>()
1 clf = ImageClassifier(verbose=True)
----> 2 clf.fit(x_train, y_train, time_limit=12 * 60 * 60)
3 clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)
4 y = clf.evaluate(x_test, y_test)
5 print(y)
/Users/victor/virtualenvlist/mydlp2/lib/python2.7/site-packages/autokeras/classifier.pyc in fit(self, x_train, y_train, time_limit)
210 start_time = time.time()
211 while time.time() - start_time <= time_limit:
--> 212 run_searcher_once(x_train, y_train, x_test, y_test, self.path)
213 if len(self.load_searcher().history) >= constant.MAX_MODEL_NUM:
214 break
/Users/victor/virtualenvlist/mydlp2/lib/python2.7/site-packages/autokeras/classifier.pyc in run_searcher_once(x_train, y_train, x_test, y_test, path)
41 backend.set_session(sess)
42 searcher = pickle_from_file(os.path.join(path, 'searcher'))
---> 43 searcher.search(x_train, y_train, x_test, y_test)
44
45
/Users/victor/virtualenvlist/mydlp2/lib/python2.7/site-packages/autokeras/search.pyc in search(self, x_train, y_train, x_test, y_test)
156 def search(self, x_train, y_train, x_test, y_test):
157 if not self.history:
--> 158 self.init_search()
159
160 # Start the new process for training.
/Users/victor/virtualenvlist/mydlp2/lib/python2.7/site-packages/autokeras/search.pyc in init_search(self)
142 print('Initializing search.')
143 graph = DefaultClassifierGenerator(self.n_classes,
--> 144 self.input_shape).generate(self.default_model_len,
145 self.default_model_width)
146 model_id = self.model_count
/Users/victor/virtualenvlist/mydlp2/lib/python2.7/site-packages/autokeras/generator.pyc in __init__(self, n_classes, input_shape)
34 class DefaultClassifierGenerator(ClassifierGenerator):
35 def __init__(self, n_classes, input_shape):
---> 36 super().__init__(n_classes, input_shape)
37
38 def generate(self, model_len=constant.MODEL_LEN, model_width=constant.MODEL_WIDTH):
TypeError: super() takes at least 1 argument (0 given)
```
From the log, I think the fit()
function in class ImageClassifier
got something wrong. Its init function in ImageClassifier didn't run well.
Someone may encounter this problem and solve it. If could, please share it.
Thanks in Advances.