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

Global Sensitivity Analysis for Categorical Features #2357

Closed

Conversation

SebastianAment
Copy link
Contributor

Summary:
Sobol sensitivity analysis and the sensitivity plots currently do not support categorical features. The plots in particular error out when categorical features are present because the sensitivity analysis (both first order and gradient-based).

This commit adds support for categorical features by

  • introducing a uniformly random integer-valued point distribution for categorical and ordinal features in SobolSensitivity, in line with the usual integer-valued encoding,
  • ignoring the sign of the derivative-based sensitivity analysis of the categorical features, since the CategoricalKernel is non-differentiable, and the "direction" of categorical features is not well defined,
  • adding a separate case for categorical features to the sensitivity analysis plot, stating that the categorical features "affect" but don't "increase" or "decrease" the metric.

Note that the results for the categorical features are still first order Sobol indices, so all the results in the plot are on the same scale.

Differential Revision: D56070326

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Apr 12, 2024
@facebook-github-bot
Copy link
Contributor

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

SebastianAment added a commit to SebastianAment/Ax that referenced this pull request Apr 12, 2024
Summary:

Sobol sensitivity analysis and the sensitivity plots currently do not support categorical features. The plots in particular error out when categorical features are present because the sensitivity analysis (both first order and gradient-based).

This commit adds support for categorical features by
- introducing a uniformly random integer-valued point distribution for categorical and ordinal features in `SobolSensitivity`, in line with the usual integer-valued encoding,
-  ignoring the sign of the derivative-based sensitivity analysis of the categorical features, since the `CategoricalKernel` is non-differentiable, and the "direction" of categorical features is not well defined,
- adding a separate case for categorical features to the sensitivity analysis plot, stating that the categorical features "affect" but don't "increase" or "decrease" the metric.

Note that the results for the categorical features are still first order Sobol indices, so all the results in the plot are on the same scale.

Differential Revision: D56070326
@facebook-github-bot
Copy link
Contributor

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

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 76.47059% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 94.92%. Comparing base (adcf3a4) to head (bf31d3f).
Report is 16 commits behind head on main.

❗ Current head bf31d3f differs from pull request most recent head c36dd93. Consider uploading reports for the commit c36dd93 to get more accurate results

Files Patch % Lines
ax/utils/sensitivity/sobol_measures.py 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2357      +/-   ##
==========================================
+ Coverage   94.91%   94.92%   +0.01%     
==========================================
  Files         491      495       +4     
  Lines       47788    48049     +261     
==========================================
+ Hits        45356    45609     +253     
- Misses       2432     2440       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

SebastianAment added a commit to SebastianAment/Ax that referenced this pull request Apr 15, 2024
Summary:

Sobol sensitivity analysis and the sensitivity plots currently do not support categorical features. The plots in particular error out when categorical features are present because the sensitivity analysis (both first order and gradient-based).

This commit adds support for categorical features by
- introducing a uniformly random integer-valued point distribution for categorical and ordinal features in `SobolSensitivity`, in line with the usual integer-valued encoding,
-  ignoring the sign of the derivative-based sensitivity analysis of the categorical features, since the `CategoricalKernel` is non-differentiable, and the "direction" of categorical features is not well defined,
- adding a separate case for categorical features to the sensitivity analysis plot, stating that the categorical features "affect" but don't "increase" or "decrease" the metric.

Note that the results for the categorical features are still first order or total Sobol indices, so all the results in the plot are on the same scale.

Differential Revision: D56070326
@facebook-github-bot
Copy link
Contributor

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

Summary:

Sobol sensitivity analysis and the sensitivity plots currently do not support categorical features. The plots in particular error out when categorical features are present because the sensitivity analysis (both first order and gradient-based).

This commit adds support for categorical features by
- introducing a uniformly random integer-valued point distribution for categorical and ordinal features in `SobolSensitivity`, in line with the usual integer-valued encoding,
-  ignoring the sign of the derivative-based sensitivity analysis of the categorical features, since the `CategoricalKernel` is non-differentiable, and the "direction" of categorical features is not well defined,
- adding a separate case for categorical features to the sensitivity analysis plot, stating that the categorical features "affect" but don't "increase" or "decrease" the metric.

Note that the results for the categorical features are still first order or total Sobol indices, so all the results in the plot are on the same scale.

Differential Revision: D56070326
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 43cef62.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants