Repository navigation
fix(drug_discovery): operator input widths default to the featurizer's - #48
Merged
Merged
Conversation
…ATURES The graph builder's bond-feature width was NUM_BOND_FEATURES beside the atom width DEFAULT_ATOM_FEATURES. It is renamed to match, ahead of the operators taking their default edge width from it. No behaviour changes.
The drug-discovery operators' input widths defaulted to 4 atom and 4 bond features, while smiles_to_graph produces DEFAULT_ATOM_FEATURES and DEFAULT_BOND_FEATURES. Several docstrings documented 34 for the same field, so a default MolecularPropertyConfig, ADMETConfig, MACCSKeysConfig, CircularFingerprintConfig, MolecularFingerprintConfig or message-passing layer raised a shape error on a real molecule, and AttentiveFPConfig defaulted to the AttentiveFP paper's 39 and 10. Each default is now the featurizer's symbol, the way chemprop derives its model width from its featurizer, so the two cannot disagree. DEFAULT_BOND_FEATURES is exported beside DEFAULT_ATOM_FEATURES. The shared test fixtures hand-encoded ethanol with a 4-feature one-hot that matched the old default rather than the graph builder; they now come from smiles_to_graph and batch_smiles_to_graphs, so the jit, grad and vmap tests run on real graphs at the default widths. The user guide's tables and examples, and the AttentiveFP plot script, use the defaults instead of hand-passed widths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes DB-078. Every drug-discovery operator's default input width is now the graph builder's width, written as its symbol, the way chemprop derives
DEFAULT_ATOM_FDIMfrom its featurizer (chemprop/conf.py, constructor default innn/message_passing/base.py). Before, the defaults were 4 and 4, so a default config raised a shape error on anysmiles_to_graphmolecule, and several docstrings documented 34 for the same field.Two commits:
NUM_BOND_FEATUREStoDEFAULT_BOND_FEATURES, with no behavior change.This is the foundation for the AttentiveFP featurization PR: once the defaults follow the featurizer, that change touches no config.
Evidence
Before:
tests/operators/drug_discovery/test_default_widths.py, 13 of 14 failed. Every default config was 4 (or 39) against the featurizer's 34, and every default operator raiseddot_general requires contracting dimensions to have the same shape, got (34,) and (4,)on aspirin.After: 14 of 14 pass. Each config default equals the symbol, and each operator and both message-passing modules, built with defaults, run on aspirin to finite outputs.
A first draft asserted a
num_edge_featuresattribute thatStackedMessagePassingdoesn't store. It was rewritten to specify behavior: the module runs on a real molecule, which fails on the old defaults and passes on the new ones.Fixtures:
molecular_graphandbatch_molecular_graphshand-encoded "ethanol" with a 4-feature one-hot (C, N, O, other) matching the old default, not the graph builder. They now come fromsmiles_to_graph("CCO")andbatch_smiles_to_graphs(["CCO", "CC"]). The JIT, gradient and vmap tests intest_drug_discovery.py(jax.jit,nnx.grad,jax.grad,jax.vmap) therefore run on real graphs at the default widths: 56 of 56 pass.Gate: soft ops, drug discovery, the DTI and MolNet benchmark tests, and integration: 637 passed.
pre-commit run --all-filespasses all 24 hooks, andmkdocs build --strictpasses.Merge Danger
Door: two-way.
Blast Radius: default widths.
NODE_FEATURESandEDGE_FEATUREStoStackedMessagePassing(multitask.py:98-99), and receptifex uses onlysimilarity; neither is affected.scripts/_advanced_plots.pystop hand-passing widths.