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

always case parameters, sampling full-factorial #34

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/source/fileFormat.farnDict.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ A farnDict
| _layers | dict | dict defining all layers. Each layer represents one nest level in the folder structure that will be generated by farn. |
| &numsp;\<LAYER> | dict | unique key defining a layer. It serves as basename for all case folders in the nest level corresponding with that layer. |
| &numsp;&numsp;_sampling | dict | dict defining sampling-type and -parameters of a layer |
| &numsp;&numsp;&numsp;_type | string | sampling type. Choices currently implemented are {'fixed', 'linSpace', 'uniformLhs', 'normalLhs', 'sobol', 'hilbertCurve'} |
| &numsp;&numsp;&numsp;_type | string | sampling type. Choices currently implemented are: |
| | | factorial: Sklearn full-factorial implementation, re-normailized to given ranges. Note that a factorial can also be achieved by cascaded linSpace layers, introducing additional hierarchy. |
| | | fixed: List of fixed values. |
| | | linSpace: Linear spacing of one dimension. Note that it places n points covering the outer limits as given in _ranges. |
| | | uniformLhs: Uniformly distributed latin-hypercube sampling. |
| | | normalLhs: Gaussian normal distributed latin-hypercube sampling. |
| | | sobol: Sobol sampling. Note that for a lower auto correlation, the parameter _onset can be given defining a later starting point in the sequence. |
| | | hilbertCurve: Hilbert multi-dimensional space-filling curve implementation. Note that the _numberOfSamples points are interpolated between start end end point. |
| &numsp;&numsp;&numsp;_names | list[string] | list naming all variables / parameters being varied in this layer. For each variable / parameter named here, sampled values will be generated. |
| &numsp;&numsp;&numsp;_values | list[list[*float]] | (required for sampling type 'fixed'): List containing lists of fixed values. For each parameter name defined in _names, one list of fixed values must exist, i.e. the number of lists in _values must match the number of parameter names defined in _names. The number of values can freely be chosen. However, all lists in _values must have the same number of values. |
| &numsp;&numsp;&numsp;_ranges | list[list[float,&nbsp;float]] | (required for sampling types 'linSpace', 'uniformLhs' and 'hilbertCurve'): List containing ranges. A range is defined through the lower and upper boundary value for the related parameter name, given as tuple (minimum, maximum). For each parameter name defined in _names, one range tuple must exist. |
| &numsp;&numsp;&numsp;_numberOfSamples | int | (required for sampling types 'linSpace', 'uniformLhs' and 'hilbertCurve'): Number of samples to be generated. In case of 'linSpace', boundary values are included if an odd number of samples is given. In case of 'uniformLHS', the given number of samples will be generated within range (=between lower and upper boundary), excluding the boundaries themselves. |
| &numsp;&numsp;&numsp;_includeBoundingBox | bool | (optional, for sampling type 'uniformLhs', 'sobol' and 'hilbertCurve'): Defines whether the lower and upper boundary values of each parameter name shall be added as additional samples. If missing, defaults to FALSE. |
| &numsp;&numsp;&numsp;_listOfSamples | list[int] | (required for sampling type 'factorial'): Number of samples to be generated per dimension. The total _numberOfSamples is calculated automatically. Note that each entry per dimension has to be larger or equal 2 for proper function of factorial. Note that the _includeBoundingBox parameter is obsolete and must not be given here. |
| &numsp;&numsp;&numsp;_includeBoundingBox | bool | (optional, for sampling type 'uniformLhs', 'sobol' and 'hilbertCurve'): Defines whether the lower and upper boundary values of each parameter name shall be added as additional samples. If missing, defaults to FALSE. Note that if invoked for sampling type 'hilbertCurve', the parameter adds two coinciding sample points: the starting and the end point of the distribution. |
| &numsp;&numsp;&numsp;_iterationDepth | int | (optional, for sampling type 'hilbertCurve'): Defines the hilbert iteration depth, default: 10. |
| &numsp;&numsp;_condition | dict | (optional) a condition allows to define a filter expression to include or exclude specific samples. (see [Filtering of Cases](#filtering-of-cases)) |
| &numsp;&numsp;&numsp;_filter | string | filter expression (see [Filter Expression](#filter-expression)) |
Expand Down
4 changes: 3 additions & 1 deletion src/farn/cli/farn.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def main():

# Configure Logging
# ..to console
log_level_console: str = "INFO" # default would usually be 'WARNING', but for farn it makes sense to set default level to 'INFO'
log_level_console: str = (
"INFO" # default would usually be 'WARNING', but for farn it makes sense to set default level to 'INFO'
)
if any([args.quiet, args.verbose]):
log_level_console = "ERROR" if args.quiet else log_level_console
log_level_console = "DEBUG" if args.verbose else log_level_console
Expand Down
13 changes: 6 additions & 7 deletions src/farn/core/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def add_parameters(
MutableSequence[Parameter], MutableMapping[str, str], None
] = None,
):
"""Add extra parameters manually"""
"""Add extra parameters manually."""
if isinstance(parameters, MutableSequence) and isinstance(
parameters[0], Parameter
):
Expand Down Expand Up @@ -290,16 +290,15 @@ def add_parameters(
self,
parameters: Union[
MutableSequence[Parameter], MutableMapping[str, str], None
] = None,
] = None,
):
'''how can this run?
'''
"""How can this run?."""
_cases: List[Case] = deepcopy(self)
for case in _cases:
case.add_parameters(parameters)
_ = case.add_parameters(parameters)

return False

def to_pandas(
self,
use_path_as_index: bool = True,
Expand Down
Loading
Loading