@@ -4,7 +4,7 @@ Parameter Estimation
4
4
==================================
5
5
6
6
Parameter Estimation using parmest requires a Pyomo model, experimental
7
- data which defines multiple scenarios, and a list of parameter names
7
+ data which defines multiple scenarios, and parameters
8
8
(thetas) to estimate. parmest uses Pyomo [PyomoBookII ]_ and (optionally)
9
9
mpi-sppy [mpisppy ]_ to solve a
10
10
two-stage stochastic programming problem, where the experimental data is
@@ -36,8 +36,8 @@ which includes the following methods:
36
36
~pyomo.contrib.parmest.parmest.Estimator.likelihood_ratio_test
37
37
~pyomo.contrib.parmest.parmest.Estimator.leaveNout_bootstrap_test
38
38
39
- Additional functions are available in parmest to group data, plot
40
- results, and fit distributions to theta values.
39
+ Additional functions are available in parmest to plot
40
+ results and fit distributions to theta values.
41
41
42
42
.. autosummary ::
43
43
:nosignatures:
@@ -92,65 +92,43 @@ Optionally, solver options can be supplied, e.g.,
92
92
93
93
>>> solver_options = {" max_iter" : 6000 }
94
94
>>> pest = parmest.Estimator(exp_list, obj_function = SSE , solver_options = solver_options)
95
-
96
-
97
-
98
- Model function
99
- --------------
100
-
101
- The first argument is a function which uses data for a single scenario
102
- to return a populated and initialized Pyomo model for that scenario.
103
-
104
- Parameters that the user would like to estimate can be defined as
105
- **mutable parameters (Pyomo `Param`) or variables (Pyomo `Var`) **.
106
- Within parmest, any parameters that are to be estimated are converted to unfixed variables.
107
- Variables that are to be estimated are also unfixed.
108
-
109
- The model does not have to be specifically written as a
110
- two-stage stochastic programming problem for parmest.
111
- That is, parmest can modify the
112
- objective, see :ref: `ObjFunction ` below.
113
-
114
- Data
115
- ----
116
-
117
- The second argument is the data which will be used to populate the Pyomo
118
- model. Supported data formats include:
119
-
120
- * **Pandas Dataframe ** where each row is a separate scenario and column
121
- names refer to observed quantities. Pandas DataFrames are easily
122
- stored and read in from csv, excel, or databases, or created directly
123
- in Python.
124
- * **List of Pandas Dataframe ** where each entry in the list is a separate scenario.
125
- Dataframes store observed quantities, referenced by index and column.
126
- * **List of dictionaries ** where each entry in the list is a separate
127
- scenario and the keys (or nested keys) refer to observed quantities.
128
- Dictionaries are often preferred over DataFrames when using static and
129
- time series data. Dictionaries are easily stored and read in from
130
- json or yaml files, or created directly in Python.
131
- * **List of json file names ** where each entry in the list contains a
132
- json file name for a separate scenario. This format is recommended
133
- when using large datasets in parallel computing.
134
-
135
- The data must be compatible with the model function that returns a
136
- populated and initialized Pyomo model for a single scenario. Data can
137
- include multiple entries per variable (time series and/or duplicate
138
- sensors). This information can be included in custom objective
139
- functions, see :ref: `ObjFunction ` below.
140
-
141
- Theta names
142
- -----------
143
-
144
- The third argument is a list of parameters or variable names that the user wants to
145
- estimate. The list contains strings with `Param ` and/or `Var ` names from the Pyomo
146
- model.
95
+
96
+
97
+ List of experiment objects
98
+ --------------------------
99
+
100
+ The first argument is a list of experiment objects which is used to
101
+ create one labeled model for each expeirment.
102
+ The template :class: `~pyomo.contrib.parmest.experiment.Experiment `
103
+ can be used to generate a list of experiment objects.
104
+
105
+ A labeled Pyomo model ``m `` has the following additional suffixes (Pyomo `Suffix `):
106
+
107
+ * ``m.experiment_outputs `` which defines experiment output (Pyomo `Param `, `Var `, or `Expression `)
108
+ and their associated data values (float, int).
109
+ * ``m.unknown_parameters `` which defines the mutable parameters or variables (Pyomo `Param ` or `Var `)
110
+ to estimate along with their component unique identifier (Pyomo `ComponentUID `).
111
+ Within parmest, any parameters that are to be estimated are converted to unfixed variables.
112
+ Variables that are to be estimated are also unfixed.
113
+
114
+ The experiment class has one required method:
115
+
116
+ * :class: `~pyomo.contrib.parmest.experiment.Experiment.get_labeled_model ` which returns the labeled Pyomo model.
117
+ Note that the model does not have to be specifically written as a
118
+ two-stage stochastic programming problem for parmest.
119
+ That is, parmest can modify the
120
+ objective, see :ref: `ObjFunction ` below.
121
+
122
+ Parmest comes with several :ref: `examplesection ` that illustrates how to set up the list of experiment objects.
123
+ The examples commonly include additional :class: `~pyomo.contrib.parmest.experiment.Experiment ` class methods to
124
+ create the model, finalize the model, and label the model. The user can customize methods to suit their needs.
147
125
148
126
.. _ObjFunction :
149
127
150
128
Objective function
151
129
------------------
152
130
153
- The fourth argument is an optional argument which defines the
131
+ The second argument is an optional argument which defines the
154
132
optimization objective function to use in parameter estimation.
155
133
156
134
If no objective function is specified, the Pyomo model is used "as is" and
@@ -161,20 +139,27 @@ stochastic programming problem.
161
139
If the Pyomo model is not written as a two-stage stochastic programming problem in
162
140
this format, and/or if the user wants to use an objective that is
163
141
different than the original model, a custom objective function can be
164
- defined for parameter estimation. The objective function arguments
165
- include `model ` and `data ` and the objective function returns a Pyomo
142
+ defined for parameter estimation. The objective function has a single argument,
143
+ which is the model from a single experiment.
144
+ The objective function returns a Pyomo
166
145
expression which is used to define "SecondStageCost". The objective
167
146
function can be used to customize data points and weights that are used
168
147
in parameter estimation.
169
148
149
+ Parmest includes one built in objective function to compute the sum of squared errors ("SSE") between the
150
+ ``m.experiment_outputs `` model values and data values.
151
+
170
152
Suggested initialization procedure for parameter estimation problems
171
153
--------------------------------------------------------------------
172
154
173
155
To check the quality of initial guess values provided for the fitted parameters, we suggest solving a
174
156
square instance of the problem prior to solving the parameter estimation problem using the following steps:
175
157
176
- 1. Create :class: `~pyomo.contrib.parmest.parmest.Estimator ` object. To initialize the parameter estimation solve from the square problem solution, set optional argument ``solver_options = {bound_push: 1e-8} ``.
158
+ 1. Create :class: `~pyomo.contrib.parmest.parmest.Estimator ` object. To initialize the parameter
159
+ estimation solve from the square problem solution, set optional argument ``solver_options = {bound_push: 1e-8} ``.
177
160
178
- 2. Call :class: `~pyomo.contrib.parmest.parmest.Estimator.objective_at_theta ` with optional argument ``(initialize_parmest_model=True) ``. Different initial guess values for the fitted parameters can be provided using optional argument `theta_values ` (**Pandas Dataframe **)
161
+ 2. Call :class: `~pyomo.contrib.parmest.parmest.Estimator.objective_at_theta ` with optional
162
+ argument ``(initialize_parmest_model=True) ``. Different initial guess values for the fitted
163
+ parameters can be provided using optional argument `theta_values ` (**Pandas Dataframe **)
179
164
180
165
3. Solve parameter estimation problem by calling :class: `~pyomo.contrib.parmest.parmest.Estimator.theta_est `
0 commit comments