Skip to content

Parameter layout: alpha and beta

Download the notebook (executed for this page) · source

Alpha is flattened gene-major using a fixed padded regulator width. Beta follows TF order: protein first, then actual sites. Alpha groups are nonnegative; signed beta groups use bounded affine sums. A no-site TF is fixed to beta=1.

from pathlib import Path
import os, sys
ROOT = next(p for p in [Path.cwd(), *Path.cwd().parents] if (p / 'pixi.toml').exists())
os.environ['TFOPT_CONFIG'] = str(ROOT / 'notebooks/data/toy.toml')
os.environ.setdefault('MPLBACKEND', 'Agg')
if str(ROOT) not in sys.path:
    sys.path.insert(0, str(ROOT))
import tfopt
import numpy as np
import pandas as pd
from notebooks.tutorial import build_problem, optimize, OUTPUT
p = build_problem()
ng,nr=p['args'][6],p['args'][4]
na=ng*nr
print('Alpha:',p['known'][:na].reshape(ng,nr))
print('Beta:',p['known'][na:])
print('Beta offsets:',p['args'][7],'site counts:',p['args'][8])
g=p['geometry']
x=np.asarray(g.decode(g.encode(p['known'])))
np.testing.assert_allclose(x,p['known'],atol=1e-12)
assert g.violation(x)<1e-12
Alpha: [[1.  0.  0. ]
 [1.  0.  0. ]
 [1.  0.  0. ]
 [0.3 0.7 0. ]
 [0.2 0.3 0.5]]
Beta: [ 1.   1.2 -0.2  0.2  0.3  0.5]
Beta offsets: [0 1 3] site counts: [0 1 2]

Interpretation

Check both fit and feasibility. For biological data, identifiability, scaling and regulatory coverage need domain review. Results and figures belong only in notebooks/outputs/.