Learning

Predict acute aquatic toxicity with a QSAR neural network

Screen acute aquatic toxicity from molecular descriptors

This QSAR neural network estimates 48-hour acute toxicity toward Daphnia magna from eight molecular descriptors. It can support early chemical prioritization and data-gap review, while laboratory evidence, chemical identity and applicability-domain assessment remain essential for regulatory or safety decisions.

546organic chemicals
82held-out testing compounds
0.703testing determination R²
0.76MAE in log units

1. Industrial challenge

Acute aquatic-toxicity testing is resource-intensive, and chemical portfolios can contain more candidates than can be tested immediately. A QSAR model provides a transparent first-pass estimate from calculated descriptors, helping specialists decide which compounds need earlier review or confirmatory testing.

Prioritize laboratory work

Rank descriptor-ready compounds for expert review and targeted 48-hour testing.

Flag higher-toxicity candidates

Use a consistent numerical screen to identify cases that deserve earlier attention.

Audit model behaviour

Inspect descriptors, predictions, residuals and model version instead of relying on a black-box score.

EcotoxicologyProduct stewardshipRegulatory scienceComputational chemistryEnvironmental risk
Scope of this example. This is an educational QSAR screening model for one defined endpoint: 48-hour Daphnia magna LC50 expressed as −log(mol/L). It is not a waiver decision, chemical-safety classification or substitute for qualified experimental evidence.

2. Data set

The aquatic-toxicity.csv file contains 546 organic chemicals, eight calculated molecular descriptors and one experimental response. The UCI record reports no missing values.

DescriptorCSV fieldEncoded information
Topological polar surface areaTPSA(Tot)Molecular polarity
Hydrogen-bond acceptor surface areaSAaccHydrogen-bond acceptance
Hydrogens bonded to heteroatomsH-050Atom-centred fragment count
Moriguchi logPMLOGPLipophilicity
Reciprocal distance connectivity indexRDCHIMolecular size and branching
Geary autocorrelation weighted by polarizabilityGATS1p2D polarizability pattern
Nitrogen atomsnNConstitutional count
Electronegative carbon fragmentsC-040Atom-centred fragment count

The target LC50 is the concentration causing 50% mortality over 48 hours, transformed to −log(mol/L). The sign matters: a larger numerical value represents a lower lethal molar concentration and therefore greater acute toxicity.

Distribution of Daphnia magna LC50 values for 546 chemicals
LC50 response distribution.
Pearson correlations between eight molecular descriptors and LC50
MLOGP and RDCHI have the strongest positive marginal relationships; correlation alone does not describe the nonlinear QSAR.
Scatter plot of LC50 against MLOGP for the complete aquatic toxicity dataset

The broad scatter around the MLOGP trend reflects chemical heterogeneity and different mechanisms of action.

Validation design. The final project uses 382 training, 82 selection and 82 testing compounds (70/15/15). Training compounds were selected to cover the standardized descriptor space; the remaining compounds were divided into matched LC50 strata. Identical eight-descriptor profiles remain together in training. This supports interpolation testing, but it is less demanding than an external chemical-series or scaffold-based validation.

3. Model

The final model keeps Neural Designer’s compact default architecture: eight standardized inputs, three tanh hidden neurons and one linear output neuron. The output is returned to −log(mol/L) and bounded to the observed response interval, 0.122–10.047.

The 8–3–1 network contains 31 trainable parameters. Its small size makes the exported calculation straightforward to audit and inexpensive to execute.

Final 8-3-1 neural network for aquatic toxicity prediction

4. Training strategy

The network minimizes normalized squared error with L2 regularization weight 0.001. Quasi-Newton training stops after 109 epochs when the minimum loss-decrease criterion is reached.

Quasi-Newton training and selection error history for the aquatic toxicity model
OptimizerEpochsTraining errorSelection errorStopping criterion
Quasi-Newton1090.442 NSE0.074 NSEMinimum loss decrease
Why selection error is lower. The space-filling training subset deliberately contains descriptor-space extremes and is more difficult than the central selection subset. The difference should not be interpreted as evidence that selection compounds influenced fitting.

5. Model selection

No hidden-size search is retained in the final workflow. The three-neuron default network is used as a compact, reproducible baseline because increasing architecture complexity did not provide a stable improvement across sample assignments.

Professional next step. Any future comparison of hidden sizes, feature subsets or algorithms should use the same fixed subsets or repeated external validation. Selecting an architecture from the testing chart would make the reported test result optimistic.

6. Testing analysis

The final Python export was independently evaluated on all 82 rows marked as testing. Neural Designer’s determination value is the squared observed–predicted correlation. MAE, RMSE and bias quantify error directly in the logarithmic response scale.

Testing compoundsDetermination R²SSE-based R²MAERMSEBias95th-percentile absolute error
820.70250.66190.76 log units0.96 log units-0.05 log units1.80 log units

The model reduces RMSE from 1.67 for a constant training-mean baseline to 0.96 log units. 75.6% of testing predictions fall within ±1 log unit, while the maximum absolute error is 2.82.

Safety-relevant pattern. Predictions cover approximately 1.86–7.43 while observed testing values span 0.59–10.05. The model therefore compresses the extremes and can underpredict the most toxic compounds. It is suitable for prioritization only when predictions carry uncertainty and applicability-domain checks.
Neural Designer goodness-of-fit chart comparing predicted and observed LC50

7. Model deployment

A credible QSAR workflow surrounds the neural calculation with chemical identity, descriptor reproducibility, applicability-domain assessment and expert review.

Verified chemical structure
Reproducible descriptors
Range and domain checks
QSAR LC50 estimate
Expert review and test decision
Why free response optimization is omitted. Optimizing the eight descriptors independently produces fractional atom counts and combinations that may not correspond to a chemically valid structure. Safer-chemical design should search real or generatable molecules, recalculate all descriptors together and enforce an applicability domain.

Try the QSAR screening model

Enter one molecular-descriptor vector. The calculation runs locally using the exact scaling, weights, output transformation and bounds from the exported Python model. Inputs outside the training range trigger a warning. This is not a certified regulatory or chemical-safety assessment.

0 to 347.32
0 to 571.952
0 to 18; integer count
-6.446 to 9.148
1 to 6.439
0.288 to 2.5
0 to 11; integer count
0 to 11; integer count
Predicted 48-hour LC50 index−log(mol/L)
Equivalent molar concentrationµmol/L

Higher −log(mol/L) means a lower lethal concentration and therefore greater predicted acute toxicity.

MLOGP directional output

This Neural Designer export varies only MLOGP while holding the other seven molecular descriptors at the reference operating point marked in grey. It shows the local response learned by the final network.

Neural Designer directional output for predicted LC50 as MLOGP varies
Interpretation boundary. The exported axis extends from approximately −10 to 10, while the observed dataset range is −6.446 to 9.148. Values outside the observed interval are extrapolations. This is a one-factor model response, not a causal chemical transformation, because molecular descriptors are coupled and some combinations may not represent a synthesizable compound.

Download and reproduce

8. Scope and limitations

  • The endpoint is 48-hour acute toxicity toward Daphnia magna, not chronic toxicity, another species or a broader ecological outcome.
  • The 546 compounds are chemically heterogeneous. Different mechanisms of action limit what one global regression can represent.
  • The CSV contains descriptors but no names, SMILES, chemical classes or explicit mode-of-action labels. Structural audit and scaffold-based splitting are therefore unavailable in this example.
  • Univariate input ranges do not define a multidimensional applicability domain. Similarity or distance to training compounds should accompany every operational prediction.
  • The 70/15/15 split is designed for interpolation and contains only 82 testing compounds. External chemical-series validation is still required.
  • Experimental LC50 variability and repeated-measure uncertainty are not propagated into prediction intervals.
  • The model compresses the response extremes and can underestimate highly toxic compounds.
  • Descriptor software, calculation settings, preprocessing and model version must remain controlled; changing them can invalidate predictions.
  • This example supports screening and prioritization. Regulatory and safety decisions require qualified review and appropriate experimental evidence.

References