Skip to content

Fix generator methods in _DenseAdaBoostClassifier to use yield from instead of return #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

msamsami
Copy link
Contributor

@msamsami msamsami commented Jul 3, 2025

This PR fixes a bug in the _DenseAdaBoostClassifier where generator methods were incorrectly using return instead of yield from when delegating to the parent class.

Problem:

The staged methods (staged_score, staged_predict, staged_decision_function, staged_predict_proba) were using return super().method() which returns a generator object instead of yielding the values from the generator.

Solution:

Changed return to yield from for all generator methods to properly delegate to the parent generator and yield values iteratively.

Methods Fixed:

  • staged_score
  • staged_predict
  • staged_decision_function
  • staged_predict_proba

This ensures the staged methods work correctly as generators and maintain API compatibility with scikit-learn's AdaBoostClassifier.

@msamsami msamsami changed the title Fix generator methods in _DenseAdaBoostClassifier to use yield from Fix generator methods in _DenseAdaBoostClassifier to use yield from instead of return Jul 4, 2025
@hamidkm9 hamidkm9 merged commit f574c07 into LinearBoost:main Jul 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants