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

Sensitivity analysis #260

Merged
merged 12 commits into from
Nov 7, 2024
Merged

Sensitivity analysis #260

merged 12 commits into from
Nov 7, 2024

Conversation

mastoffel
Copy link
Collaborator

@mastoffel mastoffel commented Oct 16, 2024

Global sensitivity analysis using sobol indices, and plotting functions.

@mastoffel
Copy link
Collaborator Author

mastoffel commented Oct 29, 2024

@MaxBalmus @aranas just tagging you because of the tutorial you are writing. Feel free / let me know if you'd like to give comments / suggestions / review. Otherwise I'd merge it tomorrow or Thursday. Here's how it will work:

This is how it currently works:

em = AutoEmulate()
em.setup(X, y)
em.compare()

emulator = em.get_model("gp")

# sensitivity analysis
problem = {
        'num_vars': 2,
        'names':  ['x1', 'x2]
        'bounds': [[0.1, 0.5]. [0.01, 0.2]]
}
Si = sensitivity_analysis(mod, problem,)
plot_sensitivity_analysis(Si, index="S1")

@MaxBalmus
Copy link
Collaborator

At a glance it looks great. I will try to look more in depth.

Just a small feature request (sorry if is is a bit pedantic): since we already have X defined, and that is usually a data frame or derived from a dataframe, can we have a problem_generator function that read X and writes problem for you? The bounds could be derived from the min/max of X.

@mastoffel
Copy link
Collaborator Author

At a glance it looks great. I will try to look more in depth.

Just a small feature request (sorry if is is a bit pedantic): since we already have X defined, and that is usually a data frame or derived from a dataframe, can we have a problem_generator function that read X and writes problem for you? The bounds could be derived from the min/max of X.

Yes, that sounds good!

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 78.87931% with 49 lines in your changes missing coverage. Please review.

Project coverage is 92.45%. Comparing base (48129e4) to head (580f340).

Files with missing lines Patch % Lines
autoemulate/sensitivity_analysis.py 62.03% 41 Missing ⚠️
autoemulate/compare.py 38.46% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
- Coverage   94.26%   92.45%   -1.82%     
==========================================
  Files          58       62       +4     
  Lines        3313     3617     +304     
==========================================
+ Hits         3123     3344     +221     
- Misses        190      273      +83     

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

Copy link
Contributor

github-actions bot commented Oct 30, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  autoemulate
  compare.py 557-566, 588
  sensitivity_analysis.py 44-49, 57, 60, 62, 67, 95, 127-130, 171, 227-241, 264-304
  tests
  test_sensitivity_analysis.py
Project Total  

This report was generated by python-coverage-comment-action

@mastoffel mastoffel force-pushed the sensitivity-analysis branch from 1bc7182 to 7b3fadd Compare October 30, 2024 16:52
@mastoffel mastoffel marked this pull request as ready for review November 7, 2024 12:32
@mastoffel
Copy link
Collaborator Author

Ok, so now if no arguments are given to sensitivity analysis, it just takes the best model from cv, refits on the full data and infers the problem definition as @MaxBalmus suggested. However, possible to do all this manually too.

em = AutoEmulate()
em.setup(X, y)
em.compare()

si = em.sensitivity_analysis()
em.plot_sensitivity_analysis(si)

@mastoffel mastoffel merged commit dcfb148 into main Nov 7, 2024
6 checks passed
@mastoffel mastoffel deleted the sensitivity-analysis branch December 2, 2024 16:43
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.

3 participants