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

feat: [DistributionBalanceMeasure] Add implementation + unit tests for custom reference distribution #1885

Merged

Conversation

ms-kashyap
Copy link
Contributor

Related Issues/PRs

Original PR for distribution balance measures - #1218

What changes are proposed in this pull request?

Context

Distribution balance measures are distance measures that can be computed between two distributions, typically between a reference and observed distribution.

These measures can help us create responsible AI products, i.e., seeing if a column (such as Gender or Ethnicity or any col) doesn't have a large skew towards one value which may lead to a biased model.

This PR

Until now, these distance measures were computed using a uniform reference distribution, meaning we expect to see each unique value in a column the same amount.

This PR allows users to specify a custom reference distribution in the form of a <string, double> map that contains <feature value, feature probability> pairs.

This will particularly be helpful for measuring data drift, where the custom reference distribution is the distribution of a baseline dataset column and the observed distribution is the distribution of the latest-versioned dataset column.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

Does this PR change any dependencies?

  • No. You can skip this section.
  • Yes. Make sure the dependencies are resolved correctly, and list changes here.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.
  • Yes. Make sure you have added samples following below steps.
  1. Find the corresponding markdown file for your new feature in website/docs/documentation folder.
    Make sure you choose the correct class estimators/transformers and namespace.
  2. Follow the pattern in markdown file and add another section for your new API, including pyspark, scala (and .NET potentially) samples.
  3. Make sure the DocTable points to correct API link.
  4. Navigate to website folder, and run yarn run start to make sure the website renders correctly.
  5. Don't forget to add <!--pytest-codeblocks:cont--> before each python code blocks to enable auto-tests for python samples.
  6. Make sure the WebsiteSamplesTests job pass in the pipeline.

@github-actions
Copy link

Hey @ms-kashyap 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@ms-kashyap ms-kashyap changed the title [DistributionBalanceMeasure] Add implementation + unit tests for custom reference distribution feat: [DistributionBalanceMeasure] Add implementation + unit tests for custom reference distribution Mar 21, 2023
@ms-kashyap
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2023

Codecov Report

Merging #1885 (f9f2486) into master (412620a) will decrease coverage by 5.98%.
The diff coverage is 89.65%.

@@            Coverage Diff             @@
##           master    #1885      +/-   ##
==========================================
- Coverage   86.95%   80.98%   -5.98%     
==========================================
  Files         301      301              
  Lines       15565    15586      +21     
  Branches      797      805       +8     
==========================================
- Hits        13535    12622     -913     
- Misses       2030     2964     +934     
Impacted Files Coverage Δ
...se/ml/exploratory/DistributionBalanceMeasure.scala 96.33% <89.65%> (-2.54%) ⬇️

... and 20 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ms-kashyap
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mhamilton723 mhamilton723 merged commit 979c629 into microsoft:master Mar 24, 2023
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.

4 participants