torchcell.models.cell_graph_transformer_metabolism.FluxScalarHead
- class FluxScalarHead(n_reactions: int, precursor_indices: Tensor, use_dense_flux: bool = True, param_dim: int = 1)[source]
Bases:
ModuleRead a scalar production phenotype off the predicted flux vector.
A production phenotype is a flux the GEM does not contain – betaxanthin’s route is a heterologous cassette, so no column of \(S\) carries it. What the GEM does carry is the precursor supply, and the readout is therefore a learned sparse combination of the native fluxes plus the turnover of the named precursor metabolites:
\[\hat y = w^\top v + u^\top \log\!\big(1+\omega_{\mathcal{P}}(v)\big) + b .\]Naming the precursor metabolites is what makes the head a hypothesis rather than another projection: for betaxanthin they are cytosolic tyrosine and its aromatic precursors, and if the flux layer carries information about production it should be visible there before it is visible anywhere else. The dense \(w^\top v\) term is kept alongside so that the precursor claim can be ablated against an unrestricted read of the same flux vector, rather than assumed.