SALib package#
Subpackages#
- SALib.analyze package
- Submodules
- SALib.analyze.common_args module
- SALib.analyze.delta module
- SALib.analyze.dgsm module
- SALib.analyze.fast module
- SALib.analyze.ff module
- SALib.analyze.hdmr module
- SALib.analyze.morris module
- SALib.analyze.pawn module
- SALib.analyze.rbd_fast module
- SALib.analyze.rsa module
- SALib.analyze.sobol module
- Module contents
- SALib.plotting package
- SALib.sample package
- Subpackages
- Submodules
- SALib.sample.common_args module
- SALib.sample.directions module
- SALib.sample.fast_sampler module
- SALib.sample.ff module
- SALib.sample.finite_diff module
- SALib.sample.latin module
- SALib.sample.saltelli module
- SALib.sample.sobol module
- SALib.sample.sobol_sequence module
- Module contents
- SALib.scripts package
- SALib.test_functions package
- SALib.util package
- Submodules
- SALib.util.problem module
ProblemSpec
ProblemSpec.samples
ProblemSpec.results
ProblemSpec.analysis
ProblemSpec.analysis
ProblemSpec.analyze()
ProblemSpec.analyze_parallel()
ProblemSpec.evaluate()
ProblemSpec.evaluate_distributed()
ProblemSpec.evaluate_parallel()
ProblemSpec.heatmap()
ProblemSpec.plot()
ProblemSpec.results
ProblemSpec.sample()
ProblemSpec.samples
ProblemSpec.set_results()
ProblemSpec.set_samples()
ProblemSpec.to_df()
- SALib.util.results module
- SALib.util.util_funcs module
- Module contents
Module contents#
- class SALib.ProblemSpec(*args, **kwargs)[source]#
Bases:
dict
Dictionary-like object representing an SALib Problem specification.
- samples#
- Type
np.array, of generated samples
- results#
- Type
np.array, of evaluations (i.e., model outputs)
- Attributes
- analysis
- results
- samples
Methods
analyze
(func, *args, **kwargs)Analyze sampled results using given function.
analyze_parallel
(func, *args[, nprocs])Analyze sampled results using the given function in parallel.
clear
()copy
()evaluate
(func, *args, **kwargs)Evaluate a given model.
evaluate_distributed
(func, *args[, nprocs, ...])Distribute model evaluation across a cluster.
evaluate_parallel
(func, *args[, nprocs])Evaluate model locally in parallel.
fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(key[, default])Return the value for key if key is in the dictionary, else default.
heatmap
([metric, index, title, ax])Plot results as a heatmap.
items
()keys
()plot
(**kwargs)Plot results as a bar chart.
pop
(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem
(/)Remove and return a (key, value) pair as a 2-tuple.
sample
(func, *args, **kwargs)Create sample using given function.
set_results
(results)Set previously available model results.
set_samples
(samples)Set previous samples used.
setdefault
(key[, default])Insert key with a value of default if key is not in the dictionary.
to_df
()Convert results to Pandas DataFrame.
update
([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values
()- property analysis#
- analyze(func, *args, **kwargs)[source]#
Analyze sampled results using given function.
- Parameters
func (function,) – Analysis method to use. The provided function must accept the problem specification as the first parameter, X values if needed, Y values, and return a numpy array.
*args (list,) – Additional arguments to be passed to func
nprocs (int,) – If specified, attempts to parallelize model evaluations
**kwargs (dict,) – Additional keyword arguments passed to func
- Returns
self
- Return type
ProblemSpec object
- analyze_parallel(func, *args, nprocs=None, **kwargs)[source]#
Analyze sampled results using the given function in parallel.
- Parameters
func (function,) – Analysis method to use. The provided function must accept the problem specification as the first parameter, X values if needed, Y values, and return a numpy array.
*args (list,) – Additional arguments to be passed to func
nprocs (int,) – Number of processors to use. Capped to the number of outputs or available processors.
**kwargs (dict,) – Additional keyword arguments passed to func
- Returns
self
- Return type
ProblemSpec object
- evaluate(func, *args, **kwargs)[source]#
Evaluate a given model.
- Parameters
func (function,) – Model, or function that wraps a model, to be run/evaluated. The provided function is required to accept a numpy array of inputs as its first parameter and must return a numpy array of results.
*args (list,) – Additional arguments to be passed to func
nprocs (int,) – If specified, attempts to parallelize model evaluations
**kwargs (dict,) – Additional keyword arguments passed to func
- Returns
self
- Return type
ProblemSpec object
- evaluate_distributed(func, *args, nprocs=1, servers=None, verbose=False, **kwargs)[source]#
Distribute model evaluation across a cluster.
Usage Conditions:
The provided function needs to accept a numpy array of inputs as its first parameter
The provided function must return a numpy array of results
- Parameters
func (function,) – Model, or function that wraps a model, to be run in parallel
nprocs (int,) – Number of processors to use for each node. Defaults to 1.
servers (list[str] or None,) – IP addresses or alias for each server/node to use.
verbose (bool,) – Display job execution statistics. Defaults to False.
*args (list,) – Additional arguments to be passed to func
**kwargs (dict,) – Additional keyword arguments passed to func
- Returns
self
- Return type
ProblemSpec object
- evaluate_parallel(func, *args, nprocs=None, **kwargs)[source]#
Evaluate model locally in parallel.
All detected processors will be used if nprocs is not specified.
- Parameters
func (function,) – Model, or function that wraps a model, to be run in parallel. The provided function needs to accept a numpy array of inputs as its first parameter and must return a numpy array of results.
nprocs (int,) – Number of processors to use. Capped to the number of available processors.
*args (list,) – Additional arguments to be passed to func
**kwargs (dict,) – Additional keyword arguments passed to func
- Returns
self
- Return type
ProblemSpec object
- heatmap(metric: str = None, index: str = None, title: str = None, ax=None)[source]#
Plot results as a heatmap.
- Parameters
metric (str or None, name of output to analyze (display all if None)) –
index (str or None, name of index to plot, dependent on what) – analysis was conducted (ST, S1, etc; displays all if None)
title (str, title of plot to use (defaults to the same as metric)) –
ax (axes object, matplotlib axes object to use for plot.) – Creates a new figure if not provided.
- Returns
ax
- Return type
matplotlib axes object
- plot(**kwargs)[source]#
Plot results as a bar chart.
- Returns
axes
- Return type
matplotlib axes object
- property results#
- sample(func, *args, **kwargs)[source]#
Create sample using given function.
- Parameters
- Returns
self
- Return type
ProblemSpec object
- property samples#