Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b3486ca
Add regularize term function, and modified SSE to add option
sscini Mar 20, 2025
76ffb22
Fixed term in function
sscini Mar 20, 2025
50d6417
Merge branch 'main' into parmest_obj_regularization
sscini Mar 26, 2025
055f14c
Update parmest.py
sscini Apr 2, 2025
626c1b9
Revert "Update parmest.py"
sscini Apr 2, 2025
e853cc2
Reapply "Update parmest.py"
sscini Apr 2, 2025
77c2832
Add theta_ref and prior_FIM to keyword args
sscini Apr 2, 2025
cfe6460
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Apr 2, 2025
7d0c956
Adjust naming convention to ensure consistency.
sscini Apr 2, 2025
fae8500
Update parmest.py, DoE meeting work
sscini Apr 2, 2025
7b16637
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Jun 23, 2025
22d9031
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Jul 1, 2025
61d72c7
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Jul 7, 2025
8f36179
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Jul 8, 2025
2d2ec2d
Updated for next round of review
sscini Jul 15, 2025
d1ab692
Added regularization weight to exp class initialize
sscini Jul 15, 2025
bd212f4
Still debugging, progress as of 7/15/2025
sscini Jul 15, 2025
31bdf53
Merge branch 'main' into parmest_obj_regularization
sscini Jan 30, 2026
ec14208
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Feb 5, 2026
a3b4b4c
Update parmest.py
sscini Feb 6, 2026
7a0f623
Fixed issues with merging changes
sscini Feb 15, 2026
31a61e9
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Feb 15, 2026
d44f13d
L2 regularization working
sscini Feb 17, 2026
906f280
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Feb 17, 2026
fec94fd
Made the theta_ref a series.
sscini Feb 17, 2026
6ecb2a3
Updated doc strings.
sscini Feb 17, 2026
865e51e
Update parmest.py
sscini Feb 17, 2026
5ffa566
added helper comments.
sscini Feb 17, 2026
53ca679
Updated implementation to add vectorized L2 calc, and reviewer questions
sscini Feb 19, 2026
ab583bb
Adjusted logging, ran black
sscini Feb 19, 2026
ac96277
Changed value to avoid zero for L2 term
sscini Feb 19, 2026
08bce8f
Commented out or removed print statements
sscini Feb 19, 2026
26bc6b6
Merge branch 'Pyomo:main' into parmest_obj_regularization
sscini Feb 19, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of Sandia, LLC, the U.S. Government retains certain rights in this
# software. This software is distributed under the 3-clause BSD License.
# ____________________________________________________________________________________

from pyomo.common.dependencies import pandas as pd
import pyomo.contrib.parmest.parmest as parmest
from pyomo.contrib.parmest.examples.rooney_biegler.rooney_biegler import (
RooneyBieglerExperiment,
)


def main():

# Rooney & Biegler Reference Values
# a = 19.14, b = 0.53
theta_ref = pd.Series({'asymptote': 20.0, 'rate_constant': 0.8})

# Create a 'Stiff' Prior for 'asymptote' but leave 'rate_constant' flexible
prior_FIM = pd.DataFrame(
[[1000.0, 0.0], [0.0, 0.0]],
index=['asymptote', 'rate_constant'],
columns=['asymptote', 'rate_constant'],
)

# Data
data = pd.DataFrame(
data=[[1, 8.3], [2, 10.3], [3, 19.0], [4, 16.0], [5, 15.6], [7, 19.8]],
columns=['hour', 'y'],
)

# Create an experiment list
exp_list = []
for i in range(data.shape[0]):
exp_list.append(RooneyBieglerExperiment(data.loc[i, :]))

# Create an instance of the parmest estimator
pest = parmest.Estimator(
exp_list,
obj_function="SSE",
regularization='L2',
prior_FIM=prior_FIM,
theta_ref=theta_ref,
regularization_weight=None,
)

# Parameter estimation and covariance
obj, theta = pest.theta_est()
cov = pest.cov_est()

if parmest.graphics.seaborn_available:
parmest.graphics.pairwise_plot(
(theta, cov, 100),
theta_star=theta,
alpha=0.8,
distributions=['MVN'],
title='Theta estimates within 80% confidence region',
)

# Assert statements compare parameter estimation (theta) to an expected value
# relative_error = abs(theta['asymptote'] - 19.1426) / 19.1426
# assert relative_error < 0.01
# relative_error = abs(theta['rate_constant'] - 0.5311) / 0.5311
# assert relative_error < 0.01

return obj, theta, cov


if __name__ == "__main__":
obj, theta, cov = main()
print("Estimated parameters (theta):", theta)
print("Objective function value at theta:", obj)
print("Covariance of parameter estimates:", cov)
Loading