mljar / mljar-supervised

Python package for AutoML on Tabular Data with Feature Engineering, Hyper-Parameters Tuning, Explanations and Automatic Documentation
https://mljar.com
MIT License
2.99k stars 400 forks source link

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

Open fernaper opened 1 year ago

fernaper commented 1 year ago

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')
pplonski commented 1 year ago

@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?

fernaper commented 1 year ago

@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.

pplonski commented 1 year ago

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