# Neural Network Model Inference

> Use when you have pre-trained MSGO model weights (PFAS or lipid variant) and a set of experimental mass spectra (either from reference evaluation sets or real wastewater/environmental samples) in CSV format with m/z and intensity pairs, and you need to obtain candidate molecular structures ranked.

- Skill: `holobiomicslab/neural-network-model-inference` (Agent Skill)
- Install (CLI): `npx skillmds@latest add holobiomicslab/neural-network-model-inference`
- Raw SKILL.md: https://api.skillmd.com/api/skills/holobiomicslab/neural-network-model-inference/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- 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/neural-network-model-inference

---


# neural-network-model-inference

## Summary

Execute pre-trained neural network model weights on new spectrometric data to generate molecular structure predictions. This skill applies a learned MSGO model to mass spectrometry or LC–QTOF spectra to produce ranked SMILES structure predictions with confidence scores.

## When to use

You have pre-trained MSGO model weights (PFAS or lipid variant) and a set of experimental mass spectra (either from reference evaluation sets or real wastewater/environmental samples) in CSV format with m/z and intensity pairs, and you need to obtain candidate molecular structures ranked by model confidence for each spectrum.

## When NOT to use

- Input spectra are not in the expected CSV format or lack required metadata (precursor m/z, polarity).
- You do not have pre-trained MSGO weights; you need to train a model first on pseudo SMILES-spectrum pairs.
- Your spectra come from a different analytical platform (not mass spectrometry) or require different preprocessing than mass spectrum peak lists.

## Inputs

- Pre-trained MSGO PyTorch model checkpoint (PFAS or lipid variant)
- CSV file with experimental spectra (m/z, intensity, precursor m/z, polarity)
- Model configuration parameters (beam_size, polarity)

## Outputs

- CSV results file with top 10 predicted SMILES structures per spectrum
- Confidence scores or ranking for each predicted structure
- Molecular structure annotations for each experimental spectrum

## How to apply

Load the pre-trained MSGO model weights from the released repository (PFAS or lipid checkpoint) using PyTorch 1.7.1 in Python 3.7. Preprocess input spectra to match the model's expected format (CSV with spectrum metadata and peak lists). Execute inference via tools/eval_standard.py with appropriate parameters: set beam_size (500 for PFAS, 300 for lipid) to control prediction breadth, specify polarity (neg for PFAS, pos for lipid), and set the output CSV path. The model performs forward pass on each spectrum and returns top-ranked SMILES predictions with corresponding confidence scores. Collect results into a CSV containing top 10 predictions per spectrum for downstream validation or literature annotation.

## Related tools

- **MSGO** (Pre-trained neural network model that performs structure generation inference on mass spectra) — https://github.com/aaronma2020/MSGO
- **PyTorch** (Deep learning framework (version 1.7.1) used to load and execute the MSGO model weights)
- **Python** (Runtime environment (version 3.7) for executing inference scripts)

## Examples

```
python tools/eval_standard.py --log_path ckpts/pfas --real_csv ./data/example/pfas.csv --out_csv ./pfas_results.csv --beam_size 500 --polar neg
```

## Evaluation signals

- Output CSV file is created with the expected schema (spectrum ID, top 10 SMILES predictions, confidence scores).
- Number of predictions per spectrum equals or is less than beam_size parameter.
- All predicted SMILES strings are valid chemical notation (verifiable by RDKit or chemistry validation library).
- Predictions on 300+ real spectrum evaluation set match or closely reproduce the reported structure-generation performance metrics from the paper.
- For wastewater LC–QTOF dataset, predicted structures can be validated against reference compounds or literature annotations.

## Limitations

- Model is specialized for PFAS or lipid structure elucidation; cross-domain applicability to other chemical classes is not demonstrated.
- Performance depends on spectrum quality and similarity to training distribution (pseudo SMILES-spectrum pairs generated by CFM-ID); novel spectra dissimilar to training data may yield lower-confidence predictions.
- The model was trained on pseudo data; real wastewater validation was performed on only one LC–QTOF dataset, limiting generalization to other real-world sample matrices.
- Inference requires exact PyTorch 1.7.1 and Python 3.7 versions; compatibility with newer versions is not stated.

## Evidence

- [other] Load the pre-trained MSGO model weights from the released github.com/aaronma2020/MSGO repository using Python 3.7 and Torch 1.7.1.: "Load the pre-trained MSGO model weights from the released github.com/aaronma2020/MSGO repository using Python 3.7 and Torch 1.7.1."
- [other] Perform inference using MSGO to generate predicted SMILES structures and corresponding confidence scores for each spectrum.: "Perform inference using MSGO to generate predicted SMILES structures and corresponding confidence scores for each spectrum."
- [readme] Download the model weights in ckpts/pfas or ckpts/lipid, run python tools/eval.py --log_path [ckpts/pfas or ckpts/lipid]: "Download the model weights in ckpts/pfas or ckpts/lipid, run
```
python tools/eval.py --log_path [ckpts/pfas or ckpts/lipid]"
- [readme] For pfas, run: python tools/eval_standard.py --log_path ckpts/pfas --real_csv ./data/example/pfas.csv --out_csv ./pfas_results.csv --beam_size 500 --polar neg: "For pfas, run :
```
python tools/eval_standard.py --log_path ckpts/pfas --real_csv ./data/example/pfas.csv --out_csv ./pfas_results.csv --beam_size 500 --polar neg"
- [readme] Then you can obatin a results csv file inluding top 10 predicts.: "Then you can obatin a results csv file inluding top 10 predicts."
- [other] The MSGO model was evaluated on one LC–QTOF dataset of wastewater samples to verify its capability for real-sample molecular structure elucidation.: "The MSGO model was evaluated on one LC–QTOF dataset of wastewater samples to verify its capability for real-sample molecular structure elucidation."

