Case Study · In Progress
Can Betaherpesvirus Teach a Model to Recognize Human Alpha- and Gammaherpesviruses?
A genome is a low-dimensional record of everything a virus does inside a cell, entry, replication, persistence, immune evasion, compressed into four letters. The host-range classifier project showed that a neural network can pull a human-adaptation signal out of that record using nothing but k-mer frequency. This follow-up asks a narrower, harder question: is that signal specific to the training data, or is it a real pattern that transfers across genuinely unseen viruses?
Orthoherpesviridae is a good place to ask that question. It splits into three subfamilies, Alpha-, Beta-, and Gammaherpesvirinae, that diverged long ago and differ in cell tropism, latency strategy, and genome organization, but all share the family's core biology. If a model trained only on Betaherpesvirus genomes can still recognize human infection in Alpha- and Gammaherpesvirus genomes it has never seen, that's evidence the network learned something about human adaptation itself, not just about Betaherpesvirinae.
A deliberately unfair test
We labeled every genome in Orthoherpesviridae human or non-human from NCBI host fields and taxonomy, then extracted 6-mer nucleotide frequencies exactly as in the host-range classifier. But instead of a random train/test split, the training set was restricted to Betaherpesvirus genomes only (n = 440), human cytomegalovirus, HHV-6, HHV-7 and their non-human relatives. Every Alphaherpesvirus (HSV-1, HSV-2, VZV) and Gammaherpesvirus (EBV, KSHV) genome, 1,220 sequences in total, was held out completely. The model never saw a single one during training.
The network itself is a straightforward feed-forward stack: three dense layers of 1,024 units, then a 256-unit layer, each followed by batch normalization and dropout, feeding a two-class output. Simple architecture, deliberately hostile evaluation.
Watching the model learn, epoch by epoch
After every training epoch, we ran PCA on the model's learned embeddings for the full dataset, training and held-out genera together, and watched how the space reorganized. At epoch 1, human and non-human sequences from every subfamily are scattered together with no structure. By epoch 25, distinct clusters have formed, and critically, the separation shows up not just for the Betaherpesvirus training genomes but for the Alpha- and Gammaherpesvirus genomes the model was never trained on.
The result: it generalizes, and the baselines don't
On the held-out 1,220 Alpha- and Gammaherpesvirus genomes, the network reached 79% accuracy, with precision and recall balanced across both classes. That's the more important detail: it isn't winning by defaulting to the majority class.
Logistic regression is the most telling failure: 0.00 precision, recall, and F1 on the human class. It didn't just generalize poorly, it never learned a usable linear boundary for human-host signal outside the training genus at all. XGBoost does better overall (66% accuracy) but only by leaning hard on non-human predictions, recall on that class is 1.00 while non-human recall is 0.32. The deep network is the only model that holds a genuinely balanced boundary across a genus it never trained on. This result held up across more than 300 architecture and hyperparameter configurations we tested before settling on the final design.
Looking inside a wrong answer
Aggregate accuracy hides individual failures, and those failures are often the more useful thing to look at. Below is the network's neuron activations for a single held-out genome, Cervid alphaherpesvirus 2 (a non-human virus infecting reindeer), propagating through each dense layer to a final prediction. The model calls it human. It's wrong, but watching where the activations diverge from a typical non-human pattern is exactly the kind of trace that turned up the telomeric-repeat story in the companion host-range classifier project.
A model trained on one herpesvirus subfamily correctly reading human-adaptation signal in two subfamilies it never saw is evidence the signal is real, not an artifact of Betaherpesvirinae specifically. The open question is what the network actually converged on: are there sequence-level "grammar" rules for human compatibility that hold across an entire virus family, or even across families entirely? Untangling that, the same way ablation work traced HHV-6's misclassification to telomeric repeat motifs, is the current focus.