Simultaneous Multi-Category Binning Optimization#15
Open
akhter-towsifa wants to merge 9 commits intocms-flaf:mainfrom
Open
Simultaneous Multi-Category Binning Optimization#15akhter-towsifa wants to merge 9 commits intocms-flaf:mainfrom
akhter-towsifa wants to merge 9 commits intocms-flaf:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements simultaneous multi-category binning optimization for statistical inference, moving from a sequential approach where categories are optimized one-by-one to a simultaneous approach where all categories in a channel are optimized together. This is computationally heavier but produces more consistent binning schemes across categories.
Changes:
- Adds new
multi_optimize_binning.pymodule withMultiBinningandMultiBayesianOptimizationclasses for simultaneous multi-category optimization - Updates
optimize_channel.pyto support simultaneous multi-category optimization mode controlled by configuration - Replaces deprecated
distutils.util.strtoboolwith a custom implementation inoptimize_binning.py - Adds
multi_category_optimizationflag tobin_optimization.yamlconfiguration
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 16 comments.
| File | Description |
|---|---|
| bin_opt/multi_optimize_binning.py | New file implementing simultaneous multi-category binning optimization with MultiBinning class and MultiBayesianOptimization algorithm |
| bin_opt/optimize_channel.py | Adds multi-category optimization path, new helper functions for multi-category result selection and input file discovery |
| bin_opt/optimize_binning.py | Replaces deprecated distutils.util.strtobool with custom implementation for Python 3.12+ compatibility |
| bin_opt/bin_optimization.yaml | Adds multi_category_optimization configuration flag (set to True) |
Comments suppressed due to low confidence (1)
bin_opt/optimize_channel.py:286
- The variable
other_cat_fileis only assigned inside the inner loop (line 284) if a matching file is found. If no matching file exists inbest_dir, the variable will be undefined when checked at line 286, causing a NameError. The check should be inside the loop or a default value should be set before the loop.
for cat_idx in range(cat_index):
cat = categories[cat_idx][0]
for file in os.listdir(best_dir):
if file.endswith('.txt') and cat in file:
other_cat_file = f"{best_dir}/{file}"
if not os.path.isfile(other_cat_file):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the binning optimization algorithm handles multi category cases in the following way:
The current algorithm assumes some correlation in kinematics between the categories, but we want a more rigorous option that will optimize all the categories in a channel simultaneously.