Skip to content

Adding functionality to choose closest matching threshold. - #2405

Open
mo-jbeaver wants to merge 5 commits into
metoppv:masterfrom
mo-jbeaver:mobt1176_threshold_selection_alternates
Open

Adding functionality to choose closest matching threshold.#2405
mo-jbeaver wants to merge 5 commits into
metoppv:masterfrom
mo-jbeaver:mobt1176_threshold_selection_alternates

Conversation

@mo-jbeaver

Copy link
Copy Markdown
Contributor

Addresses #1176

Adding changes to the plugin to choose the closest threshold, when there are multiple matching thresholds available .

Testing:

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

@brhooper brhooper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mo-jbeaver I think that this PR makes a useful improvement to the robustness of the decision tree application plugin. I've left you a few minor comments.

Comment thread improver/categorical/decision_tree.py Outdated
Comment thread improver/categorical/decision_tree.py Outdated
Comment thread improver/categorical/decision_tree.py
Comment thread improver_tests/categorical/decision_tree/test_ApplyDecisionTree.py Outdated
Comment thread improver_tests/categorical/decision_tree/test_ApplyDecisionTree.py Outdated

@brhooper brhooper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mo-jbeaver I've added another couple of minor comments.

Comment thread improver_tests/categorical/decision_tree/test_ApplyDecisionTree.py Outdated
Comment thread improver_tests/categorical/decision_tree/test_ApplyDecisionTree.py
brhooper
brhooper previously approved these changes Jul 14, 2026

@brhooper brhooper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making changes and explaining my misunderstandings to me @mo-jbeaver . Happy to approve.

@brhooper

Copy link
Copy Markdown
Contributor

@mo-jbeaver It has just occurred to me that we should add a unit test covering the case that at least 2 thresholds are identified which are equidistant from the desired threshold value. What happens in this instance? Do we need to add specific handling of this?

@mo-jbeaver

Copy link
Copy Markdown
Contributor Author

@mo-jbeaver It has just occurred to me that we should add a unit test covering the case that at least 2 thresholds are identified which are equidistant from the desired threshold value. What happens in this instance? Do we need to add specific handling of this?

@brhooper I ran some tests, and it seems that when there are multiple equidistant points then, it selects the threshold which is listed first when the thresholds are listed in the cube monotonically. I've added a sentence to the multiple threshold warning in the plugin to explain this behaviour.

@brhooper brhooper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mo-jbeaver.

Comment on lines +297 to +301
f" for name: {diagnostic}, threshold {threshold}."
f" Using closest match: {closest_point}. If multiple"
f" thresholds are equidistant to the desired threshold,"
f" then the first threshold stated monotonically will"
f" be used."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should add a unit test of this case too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unit test for multiple matching thresholds which are also equidistant has been added.

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