# Retention Time Prediction Optimization

> Use when when you have a retention-time dataset (e.g., SMRT or Eawag_XBridgeC18_364) in .xlsx format and need to train or adapt a graph neural network model to predict chromatographic retention times for new compounds.

- Skill: `holobiomicslab/retention-time-prediction-optimization-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add holobiomicslab/retention-time-prediction-optimization-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/holobiomicslab/retention-time-prediction-optimization-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- License: CC-BY-4.0
- Author: HolobiomicsLab (https://skillmd.com/u/holobiomicslab)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/holobiomicslab/retention-time-prediction-optimization-2

---


# retention-time-prediction-optimization

> **License: restricted** — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
## Summary

Train and optimize graph neural network models to predict liquid chromatography retention times for small molecules using the ABCoRT framework. This skill enables fine-tuning of pre-trained models on domain-specific retention-time datasets via transfer learning, improving prediction accuracy for chemical compound characterization.

## When to use

When you have a retention-time dataset (e.g., SMRT or Eawag_XBridgeC18_364) in .xlsx format and need to train or adapt a graph neural network model to predict chromatographic retention times for new compounds. Use this skill when baseline model performance is insufficient and transfer learning from a pre-trained checkpoint can accelerate convergence.

## When NOT to use

- Input dataset is not in .xlsx format or lacks expected column structure (SMILES, retention time labels)
- Pre-trained checkpoint is unavailable or corrupted and baseline model training is not feasible
- Retention-time data is from an entirely different chromatographic platform (e.g., GC-MS instead of LC) not covered by pre-training or transfer-learning datasets

## Inputs

- Pre-trained model checkpoint (PyTorch .pt or .pth file)
- Retention-time dataset in .xlsx format (e.g., Eawag_XBridgeC18_364.xlsx or SMRT.xlsx)
- SMILES or molecular structure representations (processed via RDKit)
- Command-line arguments specifying dataset path and optional hyperparameters

## Outputs

- Fine-tuned model checkpoint saved to disk
- Training logs and metrics (loss, validation accuracy) per epoch
- Inference predictions on test or validation splits
- TorchMetrics monitoring artifacts

## How to apply

Execute the training or transfer-learning workflow using Python entry points. For baseline training on the SMRT retention-time dataset, run 'python train_SMRT.py' to instantiate the PyTorch + PyG graph neural network and train from scratch, monitoring loss and validation metrics via TorchMetrics over epochs. For domain adaptation, run 'python train_transfer_FE.py --DataSet <dataset_name>.xlsx' to load a pre-trained checkpoint, fine-tune on your target dataset, and save the adapted model. Monitor training metrics (loss, validation accuracy) to detect convergence; save the final model checkpoint and logs upon completion. The choice between baseline and transfer training depends on data availability: transfer learning is preferred when fine-tuning datasets are small relative to the pre-training corpus.

## Related tools

- **PyTorch** (Deep learning framework for graph neural network model training and optimization)
- **PyG (PyTorch Geometric)** (Graph neural network library for molecular graph construction and message passing)
- **RDKit** (Cheminformatics toolkit for converting SMILES to molecular graphs and feature extraction)
- **Pandas** (Data loading and preprocessing for retention-time .xlsx files)
- **TorchMetrics** (Real-time training metrics monitoring (loss, validation accuracy) during fine-tuning)
- **torch-scatter, torch-sparse, torch-cluster** (GPU-accelerated graph operations for efficient PyG tensor aggregation and sampling)

## Examples

```
python train_transfer_FE.py --DataSet Eawag_XBridgeC18_364.xlsx
```

## Evaluation signals

- Training loss decreases monotonically or plateaus at a minimum over epochs, indicating model convergence
- Validation metrics (e.g., mean absolute error on held-out retention times) improve or stabilize, showing generalization
- Saved checkpoint file exists and is loadable by PyTorch without schema errors
- Inference predictions on test set fall within the expected retention-time range (e.g., 1–30 min for typical LC) and match literature or experimental references
- TorchMetrics logs record non-NaN values for all tracked metrics at each epoch

## Limitations

- Transfer learning performance depends on similarity between pre-training data (SMRT) and target dataset; significant chromatographic differences may limit transfer gains
- Model assumes molecular structures are representable as graphs with RDKit; SMILES parsing failures will cause training to fail
- No explicit hyperparameter tuning guidance provided in README; optimal learning rate, batch size, and epochs must be determined empirically
- Thirteen transfer-learning datasets are mentioned but only one (Eawag_XBridgeC18_364.xlsx) is exemplified; dataset availability and format consistency are not guaranteed

## Evidence

- [readme] train_SMRT.py script entry point for baseline model training: "If you want to train the Model. Please command 
```
python train_SMRT.py
```"
- [readme] transfer learning workflow on thirteen datasets with dataset parameter: "If you want to run the transfer learning on thirteen transfer learning data sets, use:
```
python train_transfer_FE.py --DataSet  Eawag_XBridgeC18_364.xlsx
```"
- [intro] graph neural network architecture training on SMRT retention-time dataset: "Execute the training entry point using Python with the command 'python train_SMRT.py', which will instantiate the graph neural network architecture (PyTorch + PyG)"
- [intro] TorchMetrics monitoring during fine-tuning process: "Monitor training metrics via TorchMetrics during fine-tuning. 4. Save the fine-tuned model checkpoint and training logs."
- [intro] RDKit, PyTorch, and PyG as core tools for molecular representation and training: "Execute train_transfer_FE.py with the --DataSet parameter set to Eawag_XBridgeC18_364.xlsx using PyTorch and PyG for graph neural network operations."

