agentsclimarketplace

Convolutional neural network layer design

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/convolutional-neural-network-layer-design

Use when you have 1H NMR spectral tensors as input and need to extract local features (e.g., peak patterns, signal neighborhoods) before applying attention-based or sequence-level processing.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill convolutional-neural-network-layer-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.9 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

convolutional-neural-network-layer-design

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

Summary

Design and integrate convolutional layers into a hybrid deep learning architecture to capture local spectral patterns in 1H NMR data, serving as the feature extraction foundation before global dependency modeling. This skill is essential when raw spectral tensors must be transformed into learned local feature representations suitable for downstream sequence-level processing.

When to use

You have 1H NMR spectral tensors as input and need to extract local features (e.g., peak patterns, signal neighborhoods) before applying attention-based or sequence-level processing. Use this skill when the analysis goal requires distinguishing local chemical shift environments or spectral fine structure within flavor mixture data.

When NOT to use

  • Input is already a high-level feature table or hand-crafted descriptor (e.g., integration areas, peak positions). Use this skill only on raw or minimally preprocessed spectral data.
  • The spectral data lacks local spatial structure or is already heavily compressed (e.g., a single scalar per compound). CNNs are ineffective on non-spatial or non-sequential inputs.
  • Computational budget or memory constraints preclude learning convolutional filters; use pretrained or simpler linear feature extraction instead.

Inputs

  • 1H NMR spectral tensors (shape: batch × spectral_dimension or batch × channels × spectral_length)
  • Spectral resolution and chemical shift range metadata

Outputs

  • Encoded spectral representations (feature maps) compatible with Transformer or downstream fusion components
  • Learned convolutional filter weights (internal model state)

How to apply

Define a sequence of convolutional layers in PyTorch that operate on the spectral dimension(s) of your 1H NMR input tensors. Select kernel sizes and strides appropriate to your spectral resolution; smaller kernels capture fine local patterns while larger kernels aggregate broader regions. Stack multiple convolutional blocks with non-linearities (ReLU) and optional pooling to progressively extract hierarchical local features. Verify that the output tensor shape is compatible with downstream components (e.g., Transformer encoder blocks expecting sequence-like inputs). The rationale is that CNNs exploit locality: they learn convolution filters that detect recurring patterns (peaks, multiplets) in the spectral domain, reducing dimensionality and noise before the model learns global compound-spectrum relationships.

Related tools

  • PyTorch (Framework for defining and training convolutional neural network layers (torch.nn.Conv1d, torch.nn.Conv2d, etc.) within the hybrid CNN-Transformer module) — https://pytorch.org
  • Python (Programming language for implementing CNN layer design and integration workflows)
  • FlavorFormer (Reference implementation combining CNN feature extraction with Transformer encoder for 1H NMR compound identification) — https://github.com/yfWang01/FlavorFormer
  • Anaconda (Environment management for installing PyTorch and dependencies required for CNN implementation) — https://www.anaconda.com/

Evaluation signals

  • Output tensor shape matches expected downstream component input (e.g., Transformer sequence length and feature dimension)
  • Convolutional filters learn meaningful spectral patterns (visualizable filters show peak-like or edge-like structures when applied to example spectra)
  • Feature maps show dimensionality reduction appropriate to pooling and kernel design (e.g., 50% reduction per pooling layer)
  • Hybrid model (CNN + Transformer) achieves compound identification accuracy comparable to or better than baselines on the same 1H NMR mixture dataset
  • Ablation: removing CNN component degrades model performance, confirming that local feature extraction adds value beyond attention alone

Limitations

  • CNN design (kernel sizes, depths, pooling) is dataset- and resolution-dependent; no universal hyperparameter set guaranteed to work across different NMR instruments or spectral preprocessing pipelines
  • Convolutional layers may overfit to training spectra if regularization (dropout, weight decay) or data augmentation is insufficient, especially with small flavor mixture datasets
  • CNN alone captures only local patterns; global dependencies (e.g., across distant chemical shifts) still require the Transformer encoder—the skill is incomplete without downstream integration
  • Interpretation of learned CNN filters can be challenging; it is not always clear which chemical motifs or artifacts each filter responds to without additional visualization or attribution analysis

Evidence

  • [methods] CNN feature extractor design rationale: "Define a CNN feature extractor using convolutional layers to capture local patterns in 1H NMR spectra."
  • [methods] Hybrid architecture integration: "Integrate the CNN and Transformer components into a unified hybrid encoder module with appropriate feature fusion points."
  • [intro] Architecture overview from paper: "incorporating a hybrid CNN and Transformer architecture to capture both local features and global dependencies from 1H NMR spectra"
  • [readme] Installation and tool stack: "Python 3.13.2 and Pytorch (version 2.7.0+cu118)"
  • [methods] Output compatibility requirement: "Verify the module accepts 1H NMR spectral tensors and outputs encoded representations compatible with downstream bi-encoder and cross-encoder heads."

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.