Skip to content

[WIP] Fix incorrect code in BinaryModelParameters classes - #7697

Draft
rosebyte with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-incorrect-code-binarymodelparameters
Draft

[WIP] Fix incorrect code in BinaryModelParameters classes#7697
rosebyte with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-incorrect-code-binarymodelparameters

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>Incorrect code in BinaryModelParameters classes</issue_title>
<issue_description>There is a problem with the code inside the Create method of the following classes:

  1. LinearBinaryModelParameters
  2. GamBinaryModelParameters
  3. FastTreeBinaryModelParameters
  4. FastForestBinaryModelParameters

The problem is that in those 4 cases, each Create method has a return statement that returns a SchemaBindableCalibratedModelParameters<,> object. Notice that these Create methods are supposed to load from disk, in each case, a BinaryModelParameters object of the appropriate type. So this doesn't make sense, since the SBCMP class is not supposed to be used as a BinaryModelParameter, and thus, these classes shouldn't be loaded as SBCMP objects.

I pointed at this problem inside this comment (under question number 2) while working on my PR #4306 . There, @yaeldekel responded that these pieces of code seem 'very wrong' to her, and that they might be the result of some legacy code that is no longer valid. Specifically she mentioned that in the past Calibrators where a field of predictors, and predictors were responsible of loading them at deserialization time. This is no longer the case, and her guess is that the code that I've pointed to is no longer valid.

Even more, she believes that the return new SBCMP statements I've mentioned are actually unreachable now, since they all appear in branches that only execute when there is no calibrator to load inside the BinaryModelParameters (e.g. this 'if statement'). Since predictors are no longer in charge of loading calibrators, then those paths are unreachable, and then the Create methods I've mentioned, always return the predictor of the appropriate type anyway, without getting into creating SBCMP objects.

In the case of the LinearBinaryModelParameters Create method, a ParameterMixingCalibratedModelParameters<,> object could also be returned, but this also seems invalid and unreachable for the same reasons already described for SBCMP.

Perhaps further investigation is needed to clarify all of this, and if those pieces of code are truly unreachable and no longer valid, then it might be better to remove them.</issue_description>

<agent_instructions>investigate the issues and propose a fix</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@rosebyte triage: retaining this as a model-loading compatibility investigation.

@rosebyte

rosebyte commented Sep 8, 2026

Copy link
Copy Markdown
Member

@copilot, try again

@rosebyte

rosebyte commented Sep 9, 2026

Copy link
Copy Markdown
Member

@copilot , try again

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.

Incorrect code in BinaryModelParameters classes

2 participants