Tried using this for Mnist dataset and for other image classification task, however wanted to use this for other regular binary classification tasks
Any documentation for the same?
I did have a look at the supervised main class and tried to use SearchSupervised
But kept on getting the following error:
TypeError: Can't instantiate abstract class SearchSupervised with abstract methods evaluate, final_fit, fit, predict
Any sample that I can refer to for a Binary Classification task (not image classification)?
Thanks!
I have the same problem and hope this issues can be answered.
I've considered converting two-dimensional arrays into four-dimensional data, which is then processed like image classification, but I don't think there will be any good results.
Does this help?
In essence, there, you'll find the following minimal example, assuming you have 'X_train, X_test, y_train, y_test' in the correct format.
from autokeras import MlpModule
from autokeras.backend.torch.loss_function import classification_loss
from autokeras.nn.metric import Accuracy
from autokeras.backend.torch import DataTransformerMlp
# ... define train and test data
mlpModule = MlpModule(loss=classification_loss, metric=Accuracy, searcher_args={}, verbose=True)
data_transformer = DataTransformerMlp(x_train)
train_data = data_transformer.transform_train(x_train, y_train)
test_data = data_transformer.transform_test(x_test, y_test)
fit_args = {
"n_output_node": 2,
"input_shape": x_train.shape,
"train_data": train_data,
"test_data": test_data
}
mlpModule.fit(n_output_node=fit_args.get("n_output_node"),
input_shape=fit_args.get("input_shape"),
train_data=fit_args.get("train_data"),
test_data=fit_args.get("test_data"),
time_limit=1 * 60 * 60)
Disclaimer: I've not been able to run this myself, as I have installation problems, but this is what I found and assume to work.
@christian-steinmeyer getting this error
Process ForkProcess-2:
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/root/anaconda3/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(self._args, *self._kwargs)
File "/root/anaconda3/lib/python3.6/site-packages/autokeras/search.py", line 351, in train
path=path,
File "/root/anaconda3/lib/python3.6/site-packages/autokeras/search.py", line 344, in train
File "/root/anaconda3/lib/python3.6/site-packages/autokeras/nn/model_trainer.py", line 137, in train_model
File "/root/anaconda3/lib/python3.6/site-packages/autokeras/nn/model_trainer.py", line 174, in _train
File "/root/anaconda3/lib/python3.6/site-packages/autokeras/backend/torch/loss_function.py", line 5, in classification_loss
labels = target.argmax(1)
File "/root/anaconda3/lib/python3.6/site-packages/torch/tensor.py", line 240, in argmax
return torch.argmax(self, dim, keepdim)
File "/root/anaconda3/lib/python3.6/site-packages/torch/functional.py", line 544, in argmax
retained or not. Ignored ifdim=None.
RuntimeError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
@alokgogate I had the same error because I didn't pass the labels one-hot-encoded.
I'm not sure if it is the appropriate way to do classification since MlpModel's output is a float rather than {0,1}, the "classification" loss function may not apply here.
@alokgogate I had the same error because I didn't pass the labels one-hot-encoded.
@LukasKapp-Schwoerer's suggestion should solve the problem of @alokgogate.
@huaiyizhao Could you elaborate on your reply? Perhaps have a look at #678, there, I've further explained another problem I have. In essence, the loss is undefined such that autokeras does not converge.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Does this help?
In essence, there, you'll find the following minimal example, assuming you have 'X_train, X_test, y_train, y_test' in the correct format.
Disclaimer: I've not been able to run this myself, as I have installation problems, but this is what I found and assume to work.