Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Conversation

@knottb
Copy link
Contributor

@knottb knottb commented Jan 21, 2022

Summary:
In certain cases, when inputs are integers, division will statistically round rather than converting to floating point division. This happens when the encoder scale is set to 1, which will happen after a comparison operator (e.g. sign() etc.)

I found this in the linear_svm example during evaluation as we compute accuracy = correct.add(1).div(2).mean(). The div(2) will round because the input encoder has scale 1 due to the sign in the SVM code.

This diff corrects the issue and adds this edge case to testing.

Differential Revision: D33686267

Summary:
In certain cases, when inputs are integers, division will statistically round rather than converting to floating point division. This happens when the encoder scale is set to 1, which will happen after a comparison operator (e.g. sign() etc.)

I found this in the linear_svm example during evaluation as we compute `accuracy = correct.add(1).div(2).mean()`. The `div(2)` will round because the input encoder has scale 1 due to the sign in the SVM code.

This diff corrects the issue and adds this edge case to testing.

Differential Revision: D33686267

fbshipit-source-id: 06da5d3986120d8bf64b2db438586fcf3e4d9a6f
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Jan 21, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33686267

@facebook-github-bot
Copy link
Contributor

Hi @knottb!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants