An estimated parameter is silently dropped from the simulation mapping when the model cannot give it a value
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
Start at get_optimization_to_simulation_parameter_mapping and _apply_parameter_table, then inspect lint_problem and the minimal example in the issue. Compare the mapping and lint output for k_derived; the work is done when an estimated parameter the model cannot provide is no longer silently ignored and the chosen handling is verified for the reported case.
索引モデルが issue の本文から書いたものです。
説明
A parameter that the model class leaves out of get_free_parameter_ids_with_values() is dropped from the simulation mapping even when the parameter table says to estimate it. The optimizer varies it, the simulator never sees it, and nothing reports a problem.
This is the silent sibling of #519, which covers the same root cause reached through the condition table, where it crashes instead.
What happens
get_optimization_to_simulation_parameter_mapping seeds the mapping from the model:
simulation_parameters = dict(model.get_free_parameter_ids_with_values())
_apply_parameter_table then walks the parameter table and skips any row that is not already in that mapping:
for row in parameter_df.itertuples():
if row.Index not in par_mapping:
# The current parameter is not required for this condition
continue
For a parameter whose initial assignment cannot be reduced to a number, the seeding step leaves it out, so the skip treats an estimated parameter as one this condition does not need.
Minimal example, on 0.9.0 and on current main:
import pandas as pd
import petab.v1 as petab
from petab.v1.models.sbml_model import SbmlModel
C = petab.C
problem = petab.Problem()
problem.model = SbmlModel.from_antimony(
"k_base = 1.5; k_derived = k_base + 1; conc = 1; conc' = -k_derived * conc;"
)
problem.condition_df = pd.DataFrame(
index=pd.Index(["condition1"], name=C.CONDITION_ID)
)
problem.observable_df = pd.DataFrame(
{C.OBSERVABLE_FORMULA: ["conc"], C.NOISE_FORMULA: [1.0]},
index=pd.Index(["obs_conc"], name=C.OBSERVABLE_ID),
)
problem.measurement_df = pd.DataFrame({
C.OBSERVABLE_ID: ["obs_conc"],
C.SIMULATION_CONDITION_ID: ["condition1"],
C.TIME: [1.0],
C.MEASUREMENT: [0.5],
})
problem.parameter_df = pd.DataFrame(
{
C.PARAMETER_SCALE: [C.LIN, C.LIN],
C.LOWER_BOUND: [0.1, 0.1],
C.UPPER_BOUND: [10.0, 10.0],
C.NOMINAL_VALUE: [1.5, 2.5],
C.ESTIMATE: [1, 1],
},
index=pd.Index(["k_base", "k_derived"], name=C.PARAMETER_ID),
)
print(dict(problem.model.get_free_parameter_ids_with_values()))
print(problem.x_ids)
print(problem.get_optimization_to_simulation_parameter_mapping()[0][1])
print(petab.lint_problem(problem))
Output:
{'k_base': 1.5}
['k_base', 'k_derived']
{'k_base': 'k_base'}
False
So k_derived is optimized and has no effect on the objective. lint_problem returns no error and no warning is raised.
Why it matters
An optimizer told to estimate a parameter that cannot change the simulation will still move it, so the fit reports a value for k_derived that means nothing, and the parameter's bounds and prior are silently ignored. The larger the fraction of the model that is written with initial assignments, the more of the parameter table disappears this way. Unlike #519 there is nothing to notice: no exception, no log line, no lint failure.
This is not specific to SBML. BioNetGen models have the same shape, where a parameter may be defined by an expression over other parameters, and that is where I came across it while working on #517.
Possible directions
The full answer is presumably #518, where the model exposes the expression so it can be evaluated after the parameter table is applied. Short of that, the silence seems worth fixing on its own. Either the mapping keeps a parameter-table row the model did not report, so a consumer can see it, or lint fails when a parameter marked for estimation is one the model cannot accept a value for. The second is small and would turn a wrong fit into a clear error message.
Reported from petab 0.9.0 and from main at 847b16f.
- 主要言語
- Python
- スター
- 18
- フォーク
- 9
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PEtab-dev/libpetab-python のほかの issue
-
`petab1to2`: random column name for pre-existing `experimentId` column対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
PEtab-dev/libpetab-python#568 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
PEtab-dev/libpetab-python#566 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PEtab-dev/libpetab-python#549 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PEtab-dev/libpetab-python#525 ·
メンテナーはふだん 1 日以内に返信
-
Deprecation warnings with pandas 3.1 (`inplace`, `read_csv(float_precision=...)`)対応中かも @dweindl が 3 日前に担当しました。 オープン
PEtab-dev/libpetab-python#570 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
PEtab-dev/libpetab-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Arekkazu/sgpmp-backend#744 ·
メンテナーはふだん 1 日以内に返信
-
agent/reviewer
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
projectbluefin/utah-packages#634 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 1〜2日 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
home-assistant/core#188613 ·
メンテナーはふだん 1 日以内に返信
-
Websiteオープンgood first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
TanbirRamim/open-source-radar#314 ·
メンテナーはふだん 1 日以内に返信