Simplifcation of classses and functions related to sampling#420
Simplifcation of classses and functions related to sampling#420
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
So Are these often used by users? I'm thinking a bit about how Sample is a more abstract name than Policy and Scenario, which have a clear meaning. Also a Policy is always a set of policy levers, while a scenario is a set of uncertainties, right? Having that clear separation for a user might beneficial, one way or the other. |
|
Also I think if you have one Maybe it doesn't need to be different classes, but it could have a |
Yes
I agree that this is a drawback of this change.
Currently, there is no difference between
See above, there is currently already no way to do this within any of these classes. It might be something to check in |
reimplentation and move from samplers to points
valueerrror if in combine parameter(s) exist in both collections add a concat method to combine to samples for the same set of parameters
make c1 + c2 work as shorthand for c1.concat(c2)
…nction with removal of Policy and Scenario, we can further simplify this code as well
bug fix in _setup
|
Would it be useful to add deprecation warnings, at least for the much used # ema_workbench/em_framework/points.py
class Scenario(Sample):
def __init__(self, *args, **kwargs):
warnings.warn(
"The `Scenario` class has been removed. Use `Sample` instead. See https://github.com/quaquel/EMAworkbench/pull/420",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
class Policy(Sample):
def __init__(self, *args, **kwargs):
warnings.warn(
"The `Policy` class has been removed. Use `Sample` instead. See https://github.com/quaquel/EMAworkbench/pull/420",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
__all__ = ["Sample", "Scenario", "Policy"]# ema_workbench/__init__.py
from .em_framework.points import Sample, Scenario, Policy
__all__ = ["Sample", "Scenario", "Policy"] |
The current structure of classes and functions used for representing points in a parameter space is rather convoluted and not easy to understand. This PR involves a substantial simplification of the code base, the removal of redundant code, and a renaming of various classes and functions to make the code a bit easier to comprehend.
DesignIteratortoSampleCollection. This better reflects what the class doesPointtoSample; this ties logically into theSampleCollectionsample_{}functions because this functionality has been moved intoBaseSampler.generate_samples, which now returns aSampleCollectioninstead of the numpy array with the samples.deterimine_parametersfunction, because this was a one liner arounddetermine_objects