mljar-supervised icon indicating copy to clipboard operation
mljar-supervised copied to clipboard

Better error message when total_time_limit is too small to train any model

Open fernaper opened this issue 3 years ago • 3 comments
trafficstars

Hello, I'm trying to train a classification model. Sometimes it works, and some times it is giving me the following error. The dataframe used is exactly the same each time. I can share it to you if needed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/supervised/base_automl.py", line 1089, in _fit
    params["final_loss"] = self._models[-1].get_final_loss()
IndexError: list index out of range


Please set a GitHub issue with above error message at: https://github.com/mljar/mljar-supervised/issues/new

## Error for 5_Default_RandomForest

list index out of range
Traceback (most recent call last):
  File "... my code ...", line 1268, in mljar_train
    automl.fit(X_train, y_train)
  File "/usr/local/lib/python3.9/site-packages/supervised/automl.py", line 368, in fit
    return self._fit(X, y, sample_weight, cv)
  File "/usr/local/lib/python3.9/site-packages/supervised/base_automl.py", line 1126, in _fit
    raise e
  File "/usr/local/lib/python3.9/site-packages/supervised/base_automl.py", line 1043, in _fit
    raise AutoMLException(
supervised.exceptions.AutoMLException: No models produced. 
Please check your data or submit a Github issue at https://github.com/mljar/mljar-supervised/issues/new.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "... my code ...", line 1755, in train
    return mljar_train(
  File "... my code ...", line 1271, in mljar_train
    raise exceptions.InvalidModelException(
app.core.exceptions.InvalidModelException: No model can be produced

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/supervised/base_automl.py", line 1089, in _fit
    params["final_loss"] = self._models[-1].get_final_loss()
IndexError: list index out of range


Please set a GitHub issue with above error message at: https://github.com/mljar/mljar-supervised/issues/new

The parameters pased to the autml object are:

results_path: '/app/data/model/5ff4a047/mljar'
total_time_limit: 60
mode: 'Perform'
ml_task: 'multiclass_classification'
algorithms: 'auto'

The dataframe types of X_train and y_train are:

X_train.dtypes
  z       float64
  x       float64
  ln_y    float64
dtype: object
y_train.dtype dtype('O')

fernaper avatar Oct 24 '22 10:10 fernaper

@fernaper thanks for reporting the issue.

Yes, please attach the code and data to reproduce the problem.

Maybe total_time_limit is too low? Do you have similar issues when total_time_limit=120 or more?

pplonski avatar Oct 24 '22 10:10 pplonski

@pplonski You are right, thank you very much, it is because of the total time limit, I just put a bigger value and it does not happen anymore. But is still a little bit weird that mljar returns me this internal error (list index out of range), it should return something like, "No model can be produced due to your limit of time to train the model" or something similar.

fernaper avatar Oct 24 '22 11:10 fernaper

@fernaper you are right, there should be better error message.

pplonski avatar Oct 24 '22 12:10 pplonski