Skip to content
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

Z-score Threshold tutorial #1009

Merged
merged 6 commits into from
Mar 27, 2024
Merged

Conversation

samuel-wj-chapman
Copy link
Collaborator

@samuel-wj-chapman samuel-wj-chapman commented Mar 20, 2024

Pull Request Description:

notebook tutorial guiding the user through the use of z-score and its affect on quantisation thresholds and accuracy

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

Copy link
Collaborator

@elad-c elad-c left a comment

Choose a reason for hiding this comment

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

in general:

  1. in comments: make sure you have a space after the "#" character
  2. although "quantise" is obviously correct, maybe change to "quantize" to be consistent with out code?
  3. it's clearer to write z-score (instead of "zscore"

"outputs": [],
"source": [
"#print layer name\n",
"for index, layer in enumerate(float_model.layers):\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

wouldn't print(float_model.layers[51].name) do the trick?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey, This particular layer is i believe an added quantise layer so the name does not match up directly to layer names in keras. I have added some code used to find this in the appendix. I will keep this as it is unless you feel otherwise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sorry, miss read your original comment. fixed

"To calculate a threshold $t$ for quantization based on a Z-score threshold $Z_t$, you might define $t$ as a function of $Z_t$, $\\mu$, and $\\sigma$, such as:\n",
"\n",
"$$\n",
"t(Zt)=\\frac{μ+Zt⋅σ}{μ+Zt​⋅σ}\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this just \\frac{μ+Zt⋅σ}{μ+Zt​⋅σ} = 1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nice spot, not sure why i left the fraction in there

@samuel-wj-chapman
Copy link
Collaborator Author

made all the relevant changes @elad-c thanks for feed back

Copy link
Collaborator

@elad-c elad-c left a comment

Choose a reason for hiding this comment

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

with 1 little comment

"outputs": [],
"source": [
"#print layer name\n",
"for index, layer in enumerate(float_model.layers):\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

@samuel-wj-chapman samuel-wj-chapman merged commit b773f42 into sony:main Mar 27, 2024
26 of 27 checks passed
samuel-wj-chapman added a commit to samuel-wj-chapman/model_optimization that referenced this pull request Apr 8, 2024
addition of zscore mct tutorial including updates to tutorial utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants