Repository navigation
KinOpt 0.11.0
KinOpt becomes a library with a command line and a guided GUI around it, and every run writes a run bundle: one
self-contained, checkable folder or zip with all results, for kinopt-vis. Results change: the default prediction
transform is now none, and SLSQP converges to KKT points (exact gradient, tight stopping rule), so every start that
is accepted is a verified first-order optimum. On the reference inputs this finds a better fit (objective 0.151295
instead of 0.159286, R² 0.712 instead of 0.696) and changes α and β; recompute earlier results.
Breaking changes
-
prediction_transformis now"none"(until 0.10.0: max(0, x), now available as"clip";"softplus"also
remains). Withclip, a site whose summed prediction is below zero has no gradient, which stopped the multistart
short of the best fit: on the reference inputs,clipevaluated at the bestnonesolution gives exactly the same
objective (0.153191) because no prediction is negative there, sononereaches a better optimum of the same
problem. A fitted prediction should not be negative, so every run now flags each site whose fitted prediction is
negative at any time point (a warning, the sheet "Prediction Check", the Summary row "Sites with a negative
prediction" and the bundle tableprediction_check). Setprediction_transform = "clip"for the earlier model. -
Convergence and acceptance (follow-up of #8). SLSQP gets the
exact gradient (JAX) and stops atftol = 1e-12(before: finite differences and SciPy's default 1e-6, which left a
stationarity residual of about 2e-4). A start is accepted only if it converged, every constraint residual and
bound violation is at most 1e-10, and the KKT conditions pass (stationarity at most 1e-5 relative to the gradient's
size); the selected start is the accepted start with the lowest objective. The verdict of every start is in
multistart_summary.csvand the bundle. Runs take longer: on the reference inputs 288 s instead of 212 s (64 starts,
96 cores). -
Numerical changes against 0.10.0 (reference inputs, 64 starts, the same seeds;
results_v0.11.0_reference): a
better fit (best objective 0.151295, R² 0.712) with all 64 of 64 starts accepted and the reconstruction at 36/36:0.10.0 (clip, finite differences) 0.11.0 (none, KKT acceptance) best objective (weighted); selected start 0.159286; start 28 0.151295; start 42 R² 0.696 0.712 objective over starts: median / 75th percentile / max 0.219 / 0.438 / 1.100 0.178 / 0.178 / 0.227 accepted starts 64 (rule then: converged, residuals ≤ 1e-10) 64 of 64 (also KKT) KKT stationarity of the selected start 2.2e-4 (fail) 2.3e-7 (pass) α: max / mean |Δ|; edges with |Δ| > 0.05 – 1.0 / 0.107; 31 of 94 β: max / mean |Δ|; values with |Δ| > 0.05 – 3.5 / 0.63; 50 of 75 dominant kinase changed – 5 of 36 sites edges with α = 0 23 27 (20 in both) reconstruction of Estimated from input1, α, β 36/36 36/36 (max error 1.8e-15) sites with a negative fitted prediction – 0 of 36 (smallest prediction 0.159) -
time_pointsis required in the configuration ([kinopt] time_points, the time of input1's columns in
minutes). The code no longer holds a default time grid: a configuration without it stops with an error,
RunConfig(...)needstime_points=..., thekinopt.analysisfunctions need atime_pointsargument, and
kinopt.analysis.DEFAULT_TIME_POINTSis removed. The shippedconfig.tomland the example project list them. -
scripts/is removed. Its user-facing functions are in the package:
kinopt_network_readout.py→kinopt readout/kinopt.analysis.network_readout;
curve_similarity.py→kinopt similarity/kinopt.analysis.curve_similarity.kinopt_network_viz.pyand
make_kinopt_diagram.pyare deleted. The maintainer tools (check_release.py,build_brand.py, the new
build_contract.py) are intools/, which is not in the sdist or wheel;pixi run check-releaseworks as before. -
app/(the Streamlit app) is replaced by the GUIkinopt-app. Streamlit was never a dependency. -
The app draws no plots any more. All plotting is removed from the app; the data of every former figure is a
table of the run bundle (see Run bundle, "Former
app figures"), for kinopt-vis to draw. -
kinopt.optimality.KKTis removed, as announced in 0.10.0: importkinopt.optimality.checks. -
Summary sheet: the "SSE" row changes meaning (#5). Until
0.10.0 the row "SSE" held the objective of the configured loss (the weighted objective), not a sum of squares. That
value is now in the row "Objective (weighted)" (the loss type in brackets), and "SSE" holds the plain sum of squared
residuals, a different number. Two rows are appended: "Prediction transform" and "Method". Readers that took the
objective from "SSE" must readObjective (<loss type>). -
Logs of a run go to
<results_dir>/logs(they belong to the run and go into its bundle);paths.logs_dirno
longer applies to runs. -
New runtime dependency: PyArrow (
>=24.0.0,<25, Apache-2.0) for the Parquet tables of the run bundle.
New
- The guided GUI
kinopt-app: inputs → validation → configuration (defaults pre-filled, advanced options folded
away) → run (progress, log, cancel) → results (objective and metrics, convergence, starts, constraint checks, α, β,
KKT) with the bundle download. Standard-library server, plain HTML/JS/CSS in the wheel, no new dependency. It binds
127.0.0.1 on a free port, requires a random per-session token on every request, accepts only.csvuploads up to a
size limit, and never writes outside its working folder. It calls the same functions as the command line; a test
checks that both give identical results. - Run bundles: every run writes a run bundle,
<results>/<name>.kinopt.zip(manifest with sha256 of every
file, provenance, 29 Parquet tables, the multistart parameters, and the inputs of a what-if recomputation).
kinopt bundle <results_dir>writes one from any 0.11 results folder;kinopt bundle --checkvalidates a bundle
against the published contractcontracts/kinopt/1.0(manifest.schema.json,tables.json, in
phoskintime-vis's format) and its hashes. - A library API,
kinopt.api:load_config,RunConfig,validate_inputs,run,read_results; the command
kinoptwithrun,validate,bundle,readout,similarity,exampleandapp;kinopt.__version__.
kinopt-localgains--config PATH. Each run writesrun_config.json(resolved configuration, seeds, versions,
git commit, input sha256s, selected start, KKT verdicts). - Use cases in the documentation: the command line, the library and a complete downloadable script, all run by the
test suite on a synthetic example (kinopt example; generated from a fixed seed, no data file is shipped). prediction_transform(#4) =none(default) |clip|
softplus, inconfig.toml,RunConfig,kinopt run --prediction-transformand
kinopt-local --prediction_transform; recorded in the Summary sheet,run_config.jsonand the bundle; negative
predictions are flagged per site. See the evaluation below.- Per-start KKT verdicts and acceptance: every start's stationarity, verdict and acceptance in
multistart_summary.csv, the bundle and the GUI. - KKT diagnostics (#8),
kinopt.optimality.kkt_diagnostics:
stationarity, primal and dual feasibility and complementary slackness of the selected solution, with tolerances and
pass/fail verdicts; λ from SLSQP when available, else estimated; bound multipliers estimated with μ >= 0 (BVLS). In
the workbook (sheets "KKT", "KKT Multipliers"), the bundle and the GUI;run_config.jsonalso holds the verdict with
estimated multipliers as a cross-check. - Faster SLSQP constraints (#6): the sum-to-one constraints are
evaluated as one compiled vector function. On the reference inputs, measured before the convergence change (so that
the comparison isolates this change): per-start objectives and parameters bit-identical to 0.10.0 (64 of 64), same
start selected; median time per start 99.9 s instead of 529.1 s (5.3x),
run wall time 215 s instead of 831 s (3.9x). A plain NumPy evaluation was also tried: as fast, but it sums in a
different order and is not bit-identical (best objective differs by 1.8e-5, α by up to 0.095), so it is not used. kinopt.analysis: the calculations of the former app and scripts as tested library functions returning tidy tables
(kinase activity, contributions, knockouts, dominance, fragility, load, bound pressure, network edges and nodes,
control DAG, curve similarity).
Evaluation of prediction_transform (#4)
All three transforms on the reference inputs, 64 starts with the same seeds, SciPy SLSQP as in 0.10.0 (finite
differences, before the convergence change):
| clip (0.10.0 default) | none (0.11.0 default) | softplus | |
|---|---|---|---|
| best objective (weighted) | 0.15929 | 0.15319 | 0.15571 |
| R² | 0.696 | 0.708 | 0.703 |
| objective over starts: median / 75th percentile / max | 0.219 / 0.438 / 1.100 | 0.180 / 0.182 / 0.228 | 0.196 / 0.197 / 0.221 |
| starts converged; within 1 % of the best | 64; 1 | 64; 1 | 64; 1 |
| median time per start | 102 s | 92 s | 111 s |
| fitted points whose summed prediction is negative | 0 of 504 | 0 of 504 | 108 of 504 (9 of 36 sites) |
| estimated values near zero (< 1e-6) | 0 | 0 | 0 |
| α: mean / max |Δ| against clip; edges changed by > 0.05 | – | 0.075 / 0.72; 32 of 94 | 0.14 / 1.0; 50 of 94 |
| β: mean / max |Δ| against clip; changed by > 0.1 | – | 0.72 / 5.6; 50 of 75 | 1.04 / 7.6; 57 of 75 |
| dominant kinase changed, of 36 sites | – | 3 | 9 |
At the best none solution no prediction is negative, and clip evaluated there gives the same objective (0.15319):
the clip multistart did not find that point. With clip, a start whose summed prediction goes below zero gets no
gradient there, and its objectives spread much wider across starts. softplus reaches a lower objective by using
negative summed predictions at 9 sites and moves α the most. none is the default from 0.11.0 (approved as a
named breaking change; see "Breaking changes").
KKT verdicts (#8)
On the 0.10.0 reference solution, with SLSQP's multipliers: stationarity 2.2e-4 relative to the gradient's norm
(tolerance 1e-5: fail), primal feasibility 4.4e-16, dual feasibility 0 and complementary slackness 6.6e-21
(pass); multipliers estimated by least squares give the same verdict (1.4e-4). SLSQP stopped on its
function-change tolerance with a small gradient component left. With the 0.11.0 convergence rule, the selected
reference solution passes every condition (stationarity 2.3e-7 with either multiplier source, primal feasibility
8.9e-16, dual feasibility 0, complementary slackness 5.3e-20), and all 64 starts pass (stationarity at most 4.1e-7).
The tolerance 1e-5 lies two orders of magnitude from both, so it separates converged from unconverged points
without depending on rounding noise (documented under "Convergence and acceptance").
Fixed
- The console commands could abort at exit after finishing their work ("terminate called without an active
exception", exit status 134), in a native library's teardown (PyArrow's threads;
#13). They now end with a clean exit (output flushed, exit
handlers run, the exit status kept, native teardown skipped). - A config.toml without
n_startsorjitter_scalekeeps 10 and 0.20 (askinopt-localdid in 0.10). - The network readouts pass the run's β bounds to every at-bound flag; missing values are null, not 0 (several of the
former app's and scripts' tables wrote 0); the formercurve_similarity.pyfailed with a NameError.
Upgrading
- Replace
python scripts/kinopt_network_readout.pywithkinopt readout <results_dir>and
python scripts/curve_similarity.pywithkinopt similarity <results_dir>. - Replace
streamlit run app/kinopt.pywithkinopt-app; for figures, open the run bundle in kinopt-vis. - Replace
from kinopt.optimality import KKTwithfrom kinopt.optimality import checks. - Read the objective from the Summary row "Objective (weighted)" (or the loss type of your run), not from "SSE",
which now holds the plain sum of squared residuals. - Add
time_pointsto your config.toml if it lacks it ([kinopt] time_points = [...], one per column of input1). - For the 0.10.0 model, set
prediction_transform = "clip"; the convergence rule applies to every run.