Skip to content

Conversation

@ravjot07
Copy link
Contributor

@ravjot07 ravjot07 commented Nov 22, 2025

Summary

This PR fixes an issue where XGBoostLSS requires optuna when n_trials != 0 for hyperparameter optimization, but the dependency was not properly declared in the python_dependencies tag.

Depends on #681 for testing.

Changes

  • Modified XGBoostLSS.__init__: Added logic to dynamically include optuna in python_dependencies when n_trials != 0

Problem

When n_trials is set to a non-zero value, XGBoostLSS uses hyperparameter optimization via the _hyper_opt method, which requires optuna. However, the python_dependencies tag only included xgboostlss, causing dependency checking to fail when optuna was not installed.

Solution

The fix dynamically updates the python_dependencies tag at the end of __init__:

  • When n_trials == 0: Only xgboostlss is required (no hyperparameter optimization)
  • When n_trials != 0: Both xgboostlss and optuna are required (hyperparameter optimization enabled)

This ensures the dependency checking system properly validates and installs optuna when needed, without removing test coverage.

- Modified XGBoostLSS.__init__ to dynamically add optuna to python_dependencies when n_trials != 0
- This ensures proper dependency checking when hyperparameter optimization is enabled
- Added .venv/ to .gitignore
@fkiraly fkiraly changed the title Fix: Add optuna to python_dependencies when n_trials != 0 [BUG] XGBoostLSS dynamic dependencies: add optuna to python_dependencies when n_trials != 0 Nov 22, 2025
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Kindly simplify, see above.

@fkiraly fkiraly added bug module:regression probabilistic regression module labels Nov 25, 2025
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fkiraly
Copy link
Collaborator

fkiraly commented Nov 25, 2025

the failure comes from an oversight in VM testing that does not take into account that more dependencies may need to be installed than in the class tag. I have to think about how to resolve this, but it is not an issue for your PR.

@fkiraly fkiraly merged commit eaacc79 into sktime:main Dec 11, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug module:regression probabilistic regression module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants