Skip to content

Sensitivity#63

Draft
jnnr wants to merge 45 commits into
devfrom
features/sensitivity
Draft

Sensitivity#63
jnnr wants to merge 45 commits into
devfrom
features/sensitivity

Conversation

@jnnr
Copy link
Copy Markdown
Collaborator

@jnnr jnnr commented May 29, 2022

Allows to create new EnergyDatapackages from two existing EnergyDatapackages and a sampling function. First implemented sampling functions

  • Linear slide: LInear interpolation between the two datapackages.
  • SAlib sampling methods, e.g. latin hypercube sampling Sensitivity salib #64

Copy link
Copy Markdown
Collaborator Author

@jnnr jnnr left a comment

Choose a reason for hiding this comment

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

Some comments:

Comment thread oemoflex/model/variations.py
Comment thread oemoflex/model/variations.py
Comment thread oemoflex/model/variations.py
Comment thread oemoflex/model/variations.py
Comment thread oemoflex/model/variations.py
self.eps,
).all(), f"The difference between lb and ub is lower than the defined minimum of {self.eps}"

def get_diff(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Revise naming

def get_diff(self):
return get_diff(self.lb.loc[:, self.VAR_VALUE], self.ub.loc[:, self.VAR_VALUE])

def get_param(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Revise naming

self.sanity_check()

return _dp
def sanity_check(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Decouple sample method and sanity check.

return full_samples


class EDPSensitivity(Sensitivity):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This could be done more general. The above Sensitivity class does checking and sampling for a single dataframe. This class is supposed to do the same for DataFramePackages.

The implementation takes some time to grasp - could be more transparent?

Comment thread tests/test_sensitivity.py
# assert that the last sample equals the upper-bound datapackage
assert frame_containing_nan_equal(
samples["sample_" + str(n - 1)], edp_ub_stacked.data["component"]
)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Add a check that actually compares results files.

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.

1 participant