MolecularDatasetLoader<T>

Models & Types · AiDotNet.Data.Graph

Loads molecular graph datasets (ZINC, QM9) for graph-level property prediction and generation.

Inheritance: DataLoaderBase<T> → GraphDataLoaderBase<T> → MolecularDatasetLoader<T>

Known derived types: Qm9DataLoader<T>, ZincDataLoader<T>

For Beginners

Molecular graphs represent chemistry as networks.

Graph Representation of Molecules:

Water (H₂O):

- Nodes: 3 atoms (O, H, H)
- Edges: 2 bonds (O-H, O-H)
- Node features: Atom type, charge, hybridization
- Edge features: Bond type (single, double, triple)

Why model molecules as graphs?

  • Structure matters: Same atoms, different arrangement = different properties
  • Example: Diamond vs Graphite (both pure carbon!)
  • Bonds are relationships: Like social networks, but for atoms
  • GNNs excel: Message passing mimics electron delocalization

Major Molecular Datasets:

ZINC:

  • Size: 250,000 drug-like molecules (subset: 12,000)
  • Source: ZINC database (commercially available compounds)
  • Tasks: Graph regression on constrained solubility
  • Features:
  • Atoms: C, N, O, F, P, S, Cl, Br, I (28 atom types)
  • Bonds: Single, double, triple, aromatic
  • Use case: Drug discovery, molecular generation

QM9:

  • Size: 134,000 small organic molecules
  • Source: Quantum mechanical calculations
  • Tasks: Regression on 19 quantum properties
  • Energy, enthalpy, heat capacity
  • HOMO/LUMO gap (electronic properties)
  • Dipole moment, polarizability
  • Atoms: C, H, N, O, F (up to 9 heavy atoms)
  • Use case: Property prediction, molecular design

How It Works

Molecular datasets represent molecules as graphs where atoms are nodes and chemical bonds are edges. These datasets are fundamental benchmarks for graph neural networks in drug discovery and materials science.

Constructors

Constructor Summary
MolecularDatasetLoader(MolecularDataset<T> dataset, int batchSize, string dataPath, bool autoDownload) Initializes a new instance of the MolecularDatasetLoader class.

Properties

Property Summary
int NumClasses { get; }
string Description { get; }
string Name { get; }

Methods

Method Summary
GraphClassificationTask<T> CreateGraphClassificationTask(double trainRatio, double valRatio, int? seed)
GraphGenerationTask<T> CreateGraphGenerationTask() Creates a graph generation task for molecular generation.
LinkPredictionTask<T> CreateLinkPredictionTask(double trainRatio, double negativeRatio, int? seed)
NodeClassificationTask<T> CreateNodeClassificationTask(double trainRatio, double valRatio, int? seed)