starting_params is not checked at load: an out-of-box value leaves am stuck outside the box for the whole run, extra values are dropped, too few crash with IndexError
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Start with Configuration._check_starting_params in pybnf/config.py and compare its checks with the existing start_point validation. Read the sampler initialization in pybnf/algorithms/samplers/base.py to understand how values are assigned, then find or add tests for parameter count, bounds, and the continue_run combination. Done means each invalid configuration is rejected at load with an error naming the cause.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
At load, starting_params is checked for only one thing: whether the job_type reads it (Configuration._check_starting_params in pybnf/config.py, added for #559). Its values are never checked, neither their count nor their bounds. The sampler base then copies them into every chain by position (pybnf/algorithms/samplers/base.py, lines 375–378). Three easy mistakes give three different wrong outcomes, and only one of them stops the run.
Every run below uses an analytical objective (objective = expression) with parameters declared kcat [0.5, 50], Km [1, 500], alpha [0.1, 20], and population_size = 2.
1. A value outside its box is accepted, and am then reports a posterior that sits outside the box
job_type = am, max_iterations = 300, starting_params = 69.99 70 3 (kcat is above its upper bound of 50):
exit status 0, no warning
Results/start_point.txt kcat 69.99 sampled 0.5 50
Results/samples.txt 590 rows; every one is (kcat 69.99, Km 70, alpha 3), Ln_probability -inf
Results/credible68.0_final.txt kcat 69.99 69.99
Neither chain ever moves. am rejects any proposal that leaves the box (_propose, pybnf/algorithms/samplers/adaptive_mcmc.py; #709). From a start about 20 units outside, essentially every proposal does leave it, so each iteration records the start point again. The run finishes normally, and its histograms and credible intervals describe a single point outside the parameter's own support.
With job_type = mh (step_size = 0.2), the same line is reflected back inside instead. The chain wanders from a point the user did not choose (credible68.0_final.txt: kcat 29.28 to 29.64 after 30 iterations).
start_point refuses the same value at load. Its docs say "A value outside the parameter's declared bounds is refused, not moved." starting_params gets no such check.
The likely way to get here is the one docs/config_keys.rst warns about: pasting a row from samples.txt or sorted_params*.txt. Those files sort their columns by name, while starting_params follows declaration order.
2. Extra values are silently dropped
job_type = am, starting_params = 7 70 3 99 (four values for three parameters):
exit status 0, no warning
Results/start_point.txt kcat 7 Km 70 alpha 3
The 99 is ignored. A plausible cause is a parameter that was deleted from the conf while its value stayed in the line. Then every value after the deleted parameter's position lands on the wrong parameter.
3. Too few values crash with an error that does not name the cause
job_type = am, starting_params = 7 70:
Sorry, an unknown error occurred: IndexError: list index out of range
4. Also worth deciding: continue_run = 1 together with starting_params
The docs say continue_run = 1 "overrides starting_params entirely", and it does: every chain starts from adaptive_files/MLE_params.txt. But a config that sets both is accepted without a word, so the user gets no sign that the line they wrote did nothing. AGENTS.md asks that a combination like this be refused at load.
Expected
_check_starting_params should refuse at load, with an error that names the cause:
- a count that differs from the number of free parameters, listing the parameters in declaration order;
- a value outside its declared box, naming the parameter, its value and its bounds (the same check
start_pointalready gets); - probably
continue_run = 1together withstarting_params.
Each refusal needs a test.
A separate question is whether am should ever record a sample whose Ln_probability is -inf. A chain that cannot leave its start fails silently however it got there.
Found during the review of #984.
- Lenguaje dominante
- Python
- Estrellas
- 25
- Forks
- 25
- Merge medio
- 4 h 5 min
- PR fusionados (30 d)
- 10
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de lanl/PyBNF
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
bug silent-incorrectness
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
Todos los issues de lanl/PyBNF
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
UKGovernmentBEIS/inspect_ai#6733 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ProyectoRespira/respira-webapp#334 ·
Los mantenedores suelen responder en 1 día
-
bug security-alert
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
spectrayan/carefold#391 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Jakeschincariol/instagram-agent-skill#83 ·
Los mantenedores suelen responder en 10 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 64/100