Learning

Predict chemical biodegradability with machine learning

Screen chemical structures for ready biodegradability

This reproducible QSAR tutorial maps 41 molecular descriptors to an internal ready-biodegradability screening score. On 211 held-out chemicals, the exported model reaches 88.2% accuracy, 0.867 balanced accuracy and an ROC AUC of 0.931. The result is an internal benchmark, not a regulatory prediction.

0.931testing ROC AUC
88.2%testing accuracy
0.867balanced accuracy
211held-out chemicals

1. Scientific objective

The objective is to demonstrate how a transparent tabular QSAR can prioritize chemicals by their likelihood of meeting the source data set’s ready-biodegradability label. The model can support method development and pre-screening when descriptor generation, chemical identity, applicability and uncertainty are controlled. It does not replace an OECD 301 study or an expert regulatory assessment.

Early chemical screening

Prioritize structures for experimental work before committing laboratory time and material.

Transparent operating point

Compare the default decision threshold with a sensitivity-oriented screening threshold.

Reproducible QSAR asset

Inspect the renamed schema, exact split, Neural Designer project and executable Python export.

Environmental chemistsComputational toxicologistsRegulatory scientistsChemical R&DSustainability teams
Scope. The target reproduces a binary label from a public molecular-descriptor benchmark. The page demonstrates model development and screening logic; it does not establish regulatory validity, an applicability domain or laboratory equivalence.

2. Data and provenance

The updated biodegradation.csv contains 1,055 chemicals, 41 numeric molecular descriptors and no missing values. The target contains 356 readily biodegradable and 699 not readily biodegradable records.

SubsetRowsReadily biodegradablePurpose
Training633Model-weighted during fittingEstimate 42 model parameters
Selection211Monitored during optimizationTrack generalization during training
Testing21173 positive; 138 negativeReport final internal performance

Descriptor schema

The local CSV preserves the original values and column order but replaces compact source codes with descriptive field names. Neural Designer consumes all 41 fields in this exact order.

View the exact 41-column input contract
Published CSV fieldSource descriptorFamily
laplace_leading_eigenvalueSpMax_LTopological/spectral
barysz_balaban_electronegativity_indexJ_Dz(e)Topological/spectral
heavy_atom_countnHMConstitutional
nitrogen_nitrogen_pair_frequency_distance_1F01[N-N]Functional/fragment
carbon_nitrogen_pair_frequency_distance_4F04[C-N]Topological/spectral
ssss_carbon_atom_countNssssCFunctional/fragment
substituted_benzene_sp2_carbon_countnCb-Functional/fragment
carbon_atom_percentageC%Constitutional
terminal_primary_sp3_carbon_countnCpConstitutional
oxygen_atom_countnOConstitutional
carbon_nitrogen_pair_frequency_distance_3F03[C-N]Topological/spectral
dss_carbon_e_state_sumSdssCElectronic/E-state
burden_mass_hyper_wiener_log_indexHyWi_B(m)Topological/spectral
lopping_centric_indexLOCTopological/spectral
laplace_spectral_moment_order_6SM6_LTopological/spectral
carbon_oxygen_pair_frequency_distance_3F03[C-O]Topological/spectral
mean_sanderson_electronegativity_carbon_scaledMeElectronic/E-state
mean_first_ionization_potential_carbon_scaledMiElectronic/E-state
hydrazine_nitrogen_countnN-NFunctional/fragment
aromatic_nitro_group_countnArNO2Functional/fragment
crx3_group_countnCRX3Functional/fragment
burden_polarizability_normalized_positive_spectral_sumSpPosA_B(p)Topological/spectral
circuit_countnCIRFunctional/fragment
carbon_bromine_pair_distance_1_presentB01[C-Br]Functional/fragment
carbon_chlorine_pair_distance_3_presentB03[C-Cl]Functional/fragment
n073_nitrogen_fragment_countN-073Functional/fragment
adjacency_leading_eigenvalueSpMax_ATopological/spectral
intrinsic_state_pseudoconnectivity_1dPsi_i_1dTopological/spectral
carbon_bromine_pair_distance_4_presentB04[C-Br]Functional/fragment
double_bonded_oxygen_e_state_sumSdOElectronic/E-state
laplace_second_mohar_indexTI2_LTopological/spectral
ring_tertiary_sp3_carbon_countnCrtFunctional/fragment
r_cx_r_fragment_countC-026Functional/fragment
carbon_nitrogen_pair_frequency_distance_2F02[C-N]Topological/spectral
hydrogen_bond_donor_atom_countnHDonConstitutional
burden_mass_leading_eigenvalueSpMax_B(m)Topological/spectral
intrinsic_state_pseudoconnectivity_type_s_averagePsi_i_ATopological/spectral
nitrogen_atom_countnNConstitutional
burden_mass_spectral_moment_order_6SM6_B(m)Topological/spectral
aromatic_ester_countnArCOORFunctional/fragment
halogen_atom_countnXConstitutional
Class distribution with 356 readily biodegradable and 699 not readily biodegradable records
The full data set is imbalanced: 33.7% positive and 66.3% negative.
Univariate descriptor associations with the ready-biodegradability label
These are one-descriptor associations. They are not causal effects, mechanistic explanations or multivariable feature importance.
Provenance. The data are the UCI QSAR biodegradation data set, derived from the study by Mansouri et al. The UCI table supplies descriptors and the binary endpoint but no CAS identifiers, SMILES, structures, individual test protocols or descriptor-generation workflow. Those omissions constrain auditability and prospective use.

3. Model

Thirty-eight descriptor inputs use mean-and-standard-deviation scaling; the three binary bromine/chlorine indicators use minimum–maximum scaling. The scaled inputs connect directly to one sigmoid output, so this is a nonlinear-preprocessing plus logistic classification model with 42 trainable parameters and no hidden layer.

The output is named readily_biodegradable. A larger value supports the positive class, but the sigmoid score has not been calibrated as a probability.

Output contract. Supply all 41 descriptors in the published order. Do not supply a chemical name, formula or SMILES string directly, and do not report the score as regulatory confidence.
Initial and final direct sigmoid architecture with 41 molecular descriptor inputs and one ready-biodegradability output
The same direct 41–1 architecture is used from initialization through final testing; no hidden-layer or neuron-selection experiment was performed.

4. Training strategy

The model minimizes a class-weighted squared error with the quasi-Newton method and no explicit regularization. The positive-class weight is 1.4817 and the negative-class weight is 0.7546, compensating partly for the class imbalance.

Training error falls from 1.1168 to 0.2722 over 91 completed epochs. Selection error reaches its minimum of approximately 0.257 at epoch 16 and later rises to 0.3447, while training error continues to improve.

Training and selection weighted-squared-error histories over 91 epochs
The divergence after the selection minimum indicates overfitting. The downloadable export is the stored final model, not an automatically restored epoch-16 checkpoint.
Training implication. A production rerun should preserve and compare the lowest-selection-error checkpoint, then lock the testing set until the model and threshold are finalized.

5. Model selection and baseline

No neuron selection or architecture selection was performed. The direct 41–1 classifier is both the base and final architecture. The selection subset was used to monitor optimization, not to search across model sizes.

ReferenceTesting accuracyBalanced accuracyInterpretation
Always predict the majority class65.4%50.0%Null decision rule for the testing prevalence
Final direct sigmoid model88.2%86.7%Material improvement on this internal split

The simple model is a useful transparent baseline. More complexity is not justified until checkpointing, external validation and applicability-domain controls have been addressed.

6. Scientific validation

The held-out testing subset contains 73 positive and 138 negative chemicals. At the default 0.50 threshold, the model classifies 186 of 211 correctly. The ROC analysis evaluates ranking across all thresholds and reports an AUC of 0.931 with a 95% interval from 0.896 to 0.966.

Testing metricValueOperational meaning at threshold 0.50
ROC AUC0.931Threshold-independent ranking reported by Neural Designer
Accuracy88.15%186 correct classifications from 211
Sensitivity82.19%60 of 73 positive records detected
Specificity91.30%126 of 138 negative records rejected
Precision83.33%60 of 72 positive calls correct
F1 score82.76%Harmonic balance of precision and sensitivity
Balanced accuracy86.75%Equal weighting of sensitivity and specificity
ROC curve for the held-out biodegradation testing subset
ROC AUC = 0.931. Threshold selection must follow the intended screening cost, not the visual optimum alone.

Confusion matrix at threshold 0.50

Actual / predictedReadily biodegradableNot readily biodegradableTotal
Readily biodegradable601373
Not readily biodegradable12126138
Total72139211
Scientific interpretation. The model separates the two labels well on this random internal split. It has not been tested on an independent chemical collection or on a structure-aware split, so performance on new scaffolds and chemical families remains unknown.

7. Inference and reproducibility

A professional workflow starts from an identified chemical structure, calculates the same descriptor definitions with a versioned toolchain, verifies schema and applicability, produces a score, applies a pre-approved operating threshold and routes the result to expert or laboratory confirmation.

Verified structure
Versioned descriptor calculation
Schema and domain checks
Model score
Operating threshold
Expert or OECD 301 follow-up

Screening-threshold scenario

Changing the threshold does not improve the model; it changes the balance between missed positive chemicals and additional positive calls. A sensitivity-oriented screen can use the ROC-derived 0.29 operating point to miss fewer readily biodegradable records, at the cost of more false positives.

ThresholdTPFNFPTNSensitivitySpecificityPrecisionAccuracy
0.50 default60131212682.2%91.3%83.3%88.2%
0.29 sensitivity-oriented6491911987.7%86.2%77.1%86.7%

Result. The 0.29 threshold detects four additional positives in this testing subset, while creating seven additional false-positive calls. Which trade-off is acceptable depends on whether the next step is inexpensive prioritization or a consequential decision.

Illustrative exported-model calculation

The descriptor vector packaged with the export returns a score of 0.11151. It is below both demonstrated thresholds and is therefore assigned to the not-readily-biodegradable class in either scenario.

The vector is not a row of the published table and has no supplied chemical identifier. It demonstrates the software interface only; it is not an extra validation compound.

Exported sigmoid score0.11151

Classification: not readily biodegradable at 0.50 and 0.29.

Reproduce the calculation

The Python package includes the exact model, ordered input schema, illustrative descriptor vector and expected score. The Neural Designer package preserves the split, trained parameters and regenerated analyses.

from model import NeuralNetwork

score = NeuralNetwork().calculate_outputs(descriptors)[0]
screening_class = int(score >= 0.50)

8. Validity, uncertainty and limitations

  • Internal random split only. The 633/211/211 partition does not test generalization to unseen scaffolds, chemical families or a later external collection.
  • No applicability domain. The project does not define leverage, similarity, descriptor-range or structural-alert criteria for accepting a prediction.
  • Incomplete chemical traceability. The UCI table does not include CAS numbers, SMILES, structures, assay-level metadata or the descriptor-calculation implementation required to reproduce a prediction from a named substance.
  • Endpoint abstraction. The binary target aggregates source ready-biodegradability outcomes; it is not a direct simulation of one fully documented OECD 301 protocol.
  • Uncalibrated scores. The sigmoid output is useful for ranking and thresholding but is not demonstrated to be a calibrated probability.
  • Training/checkpoint risk. Selection error is lowest near epoch 16, whereas the stored export comes from the later final epoch.
  • Regulatory boundary. OECD guidance expects a defined endpoint and algorithm, an applicability domain, appropriate predictivity measures and, where possible, mechanistic interpretation. This tutorial does not satisfy that complete package.
Decision boundary. Use the model for reproducible research and pre-screening. Confirm consequential conclusions with documented expert review and appropriate experimental evidence.

References