Result¶
Every pipeline element reports through an
ElementResult; the fitting results below
extend it.
- class ionworkspipeline.results.ElementResult(parameter_values: dict | None = None)¶
Base class for typed pipeline element results.
Subclasses set a unique
typeClassVar and overrideto_config()to expose their payload fields.Extends:
ParameterValues- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- ionworkspipeline.Result¶
alias of
ParameterEstimatorResult
- class ionworkspipeline.ParameterEstimatorResult(parameter_values: dict | None = None, *, cost: float | None = None, samples: Any = None, costs: Any = None, callbacks: dict | None = None, callback_results: dict | None = None, children: list[ParameterEstimatorResult] | None = None, initial_guess: dict | None = None, job_id: int | None = None)¶
Abstract marker for DataFit-family results.
Extends:
ElementResult- best_results(num_results: int | integer | None = None) list[ParameterEstimatorResult]¶
Return best
num_resultschildren by ascending cost (None = all).
- direct_samples: ClassVar[bool] = False¶
Class-level flag indicating that the parameter estimator populates
samplesandcostsdirectly from a multi-point evaluation (PosteriorResultfor MCMC,EnsembleResultfor grid/point/batch eval). Optimizer-style results leave thisFalseand DataFit fillssamplesfrom the cost-logger history instead.
- get_fit_results()¶
Per-objective fit-result dicts from internal callbacks.
- plot_fit_results()¶
Plot per-objective fit results.
- replace(**overrides) ParameterEstimatorResult¶
Return a new instance with
overridesapplied to init fields.
- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- class ionworkspipeline.OptimizationResult(parameter_values: dict | None = None, *, x: Any = None, fun: float | None = None, success: bool | None = None, message: str | None = None, evaluations: int | None = None, iterations: int | None = None, **kw)¶
DataFit return for deterministic optimizers (CMAES, Scipy, …).
Extends:
ParameterEstimatorResult- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- class ionworkspipeline.EnsembleResult(parameter_values: dict | None = None, *, x: Any = None, method: str | None = None, **kw)¶
DataFit return for ensemble-of-points evaluators (grid search, point estimate, batch point estimate).
Holds the parameter vectors evaluated (
samples), their objective values (costs), and the best point (x). MirrorsOptimizationResultshape without optimizer-specific fields (success/message/evaluations/iterations) since these methods perform a fixed batch of evaluations rather than an iterative search.Extends:
ParameterEstimatorResult- direct_samples: ClassVar[bool] = True¶
Class-level flag indicating that the parameter estimator populates
samplesandcostsdirectly from a multi-point evaluation (PosteriorResultfor MCMC,EnsembleResultfor grid/point/batch eval). Optimizer-style results leave thisFalseand DataFit fillssamplesfrom the cost-logger history instead.
- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- property x¶
Best (lowest-cost) sample row.
Falls back to
samples[nanargmin(costs)]when not explicitly set.
- class ionworkspipeline.PosteriorResult(parameter_values: dict | None = None, *, chains: Any = None, chains_storage_ref: str | None = None, log_pdfs: Any = None, parameter_names: list[str] | None = None, burnin: int = 0, method: str | None = None, acceptance_rate: float | None = None, r_hat: dict[str, float] | None = None, ess: dict[str, float] | None = None, posterior_summary: dict[str, dict[str, float]] | None = None, **kw)¶
DataFit return for MCMC samplers (e.g. Pints).
Extends:
ParameterEstimatorResult- credible_interval(name: str, level: float = 0.95) tuple[float, float]¶
Equal-tailed credible interval at
level.
- direct_samples: ClassVar[bool] = True¶
Class-level flag indicating that the parameter estimator populates
samplesandcostsdirectly from a multi-point evaluation (PosteriorResultfor MCMC,EnsembleResultfor grid/point/batch eval). Optimizer-style results leave thisFalseand DataFit fillssamplesfrom the cost-logger history instead.
- property posterior_summary: dict[str, dict[str, float]] | None¶
Per-parameter
{mean, std, median, q05, q95}.
- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- property x¶
Lowest-cost sample row (parity with scipy
OptimizeResult).
- class ionworkspipeline.RegressionResult(parameter_values: dict | None = None, *, x: Any = None, results: Any = None, **kw)¶
DataFit return for
Regressoroptimizers.Extends:
ParameterEstimatorResult- to_config() dict¶
Convert the parameter values to a JSON-serializable dictionary.
Optionally saves to a file.
Parameters¶
- filenamestr, optional
The filename to save the JSON file to. If not provided, the dictionary is not saved.
Returns¶
- dict
The JSON-serializable dictionary.
Examples¶
>>> param = pybamm.ParameterValues({"Temperature [K]": 298.15}) >>> param_dict = param.to_json() # Get dictionary >>> isinstance(param_dict, dict) True >>> param.to_json("parameters.json") {'Temperature [K]': 298.15}
- ionworkspipeline.data_fits.results.combine(children: list[ParameterEstimatorResult]) ParameterEstimatorResult¶
Combine children into a single result (single-child returns as-is).