Ensemble property prediction
The ensemble command is a fast, transparent set of proxy models for drug-like properties. It is not a trained graph neural network; every value is a deterministic function of 2D descriptors.
Pipeline
flowchart LR
A[SMILES] --> B[2D descriptors]
B --> C[Three LogP models]
C --> D[Consensus LogP + std]
B --> E[ESOL-like solubility]
B --> F[TPSA / Veber]
B --> G{Acidic group?}
G -- yes --> H[pKa acidic]
G -- no --> I[null]
B --> J{Nitrogen present?}
J -- yes --> K[pKa basic]
J -- no --> L[null]
D --> M[BBB score]
F --> M
M --> N[Confidence]
H --> O[EnsembleResult]
I --> O
K --> O
L --> O
N --> O
Fields
| Field | Meaning |
|---|---|
logp, logp_std | mean and standard deviation of three LogP proxies |
log_solubility | ESOL-like log S (mol/L) |
tpsa | Ertl TPSA in Ų |
pka_acidic | acidic pKa estimate, or null when no donor group is present |
pka_basic | basic pKa estimate, or null when the molecule contains no nitrogen |
veber | TPSA ≤ 140 Ų and rotatable bonds ≤ 10 |
bbb_permeable, bbb_score | lipophilicity/TPSA/PSA heuristic |
confidence | model agreement (LogP spread) and molecular-size coverage |
The basic-pKa heuristic requires an actual nitrogen atom. An oxygen hydrogen-bond acceptor alone, such as ethanol, must not produce a basic centre; this was a defect fixed during the functional audit.
Example
$ sci-form ensemble "CCO"
{
"logp": -0.5850213822006243,
"logp_std": 0.9045703967460684,
"log_solubility": 0.3749356707863932,
"tpsa": 20.23,
"pka_acidic": 13.371400000000001,
"pka_basic": null,
"veber": { "tpsa_ok": true, "rotb_ok": true, "passes": true },
"bbb_permeable": true,
"bbb_score": 0.8,
"confidence": 0.6834003611388759
}Caveats
- The pKa and BBB values are group heuristics, not first-principles results. Use the pKa workflow for quantitative work.
- The confidence reflects LogP model agreement and molecule size, not a calibrated error bar.
- Amide and pyrrole nitrogens are not excluded by the basic-pKa heuristic yet.
Surfaces
| Surface | Entry point |
|---|---|
| CLI | sci-form ensemble "<SMILES>" |
| Rust | sci_form::predict_ensemble_from_smiles(smiles) |
| Python | sci_form.predict_ensemble(smiles) |
Validation
The JSON/SMILES entry points reject empty or whitespace SMILES, malformed SMILES and unknown elements. The generic Rust arrays are validated by ml::predict_ensemble_checked: non-empty elements, atomic numbers 1..=118, bond indices inside the molecule, no self-bonds, bond orders 1..=4, charges and aromatic flags either empty or exactly one per atom, all values finite. Every numeric output must be finite; confidence and BBB scores are clamped to 0..1. The historical infallible predict_ensemble remains for trusted callers. Empty SMILES previously produced a zero-molecule ensemble on WASM; it now returns {"error": ...} and matches Python's ValueError.
- Ethanol has an acidic estimate and no basic centre.
- Methylamine has a basic centre above pH 8; pyridine has one below pH 8.
- Acetic acid returns an acidic pKa near 4.
- Invalid SMILES returns exit code 1 from the CLI.