# bhuvanmdev/deepchem architecture

> Architecture diagram of the GitHub repository bhuvanmdev/deepchem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhuvanmdev/deepchem
- Repository: https://github.com/bhuvanmdev/deepchem

## Overview

##### Project Type and Purpose
- Type: Open-source Python library/toolchain.
- Purpose: Provide modular data loading, featurization, modeling, optimization, and evaluation routines that integrate with TensorFlow, PyTorch, and JAX.

##### High-Level Components
From the file tree and README, we can break DeepChem into these main components:
A. Core Library Package (deepchem/)
1. Data Module (deepchem.data) – data loaders, dataset objects, support for CSV, SDF, BAM, FASTA, etc.
2. Featurizers Module (deepchem.feat) – molecular, sequence, material, and grid featurizers.
3. Models Module (deepchem.models) – wrappers & implementations for TensorFlow, Keras, PyTorch, JAX, scikit-learn, GBDT, GAN, FCNet, graph conv, etc.
4. MolNet Module (deepchem.molnet) – standardized dataset fetchers and benchmarks.
5. Docking Module (deepchem.dock) – binding-pocket detection, docking, pose scoring.
6. Reinforcement-Learning Module (deepchem.rl) – A2C, PPO, with both native and torch backends.
7. Hyperparam-Opt Module (deepchem.hyper) – grid, random, Bayesian optimization.
8. Metalearning Module (deepchem.metalearning) – MAML algorithms.
9. Metrics Module (deepchem.metrics) – classification/regression metrics.
10. Splitters & Transformers (deepchem.splits, deepchem.trans) – data splitting and transformation pipelines.
11. Utilities (deepchem.utils) – caching, RDKit wrappers, DFT routines, molecular graphs, differentiation tools, file I/O.

B. Auxiliary Directories
- contrib/ – community-contributed model/dataset scripts (e.g., DeepMHC, mol2vec).
- datasets/ – raw data files and dataset construction scripts.
- examples/ – end-to-end examples and tutorials.
- docs/ – Sphinx/RST documentation source.
- docker/ – Dockerfiles for TF/PyTorch/JAX variants.
- CI/CD (.github/workflows) – build, test, docs pipelines.

C. External Services & Dependencies
- Compute Frameworks: TensorFlow, PyTorch, JAX
- Scientific Libraries: NumPy, pandas, SciPy, scikit-learn, RDKit
- CI/CD: GitHub Actions, ReadTheDocs, DockerHub

##### Relationships & Data Flows
- Data Ingestion: external raw files (datasets/) → deepchem.data → deepchem.feat → feature tensors.
- Model Training: feature tensors → deepchem.models (TensorGraph, TorchModel, JAXModel) → training loop → callbacks → metrics.
- Hyperparameter Optimization: wraps model training with deepchem.hyper.
- Reinforcement Learning & Docking: deepchem.rl & deepchem.dock modules consume custom environment/structure inputs, produce learned policies/scores.
- Benchmarking & Utilities: deepchem.molnet orchestrates train/valid/test splits and invokes deepchem.models & deepchem.metrics.
- Extensibility: contrib/ scripts plug into core modules via standardized interfaces (e.g., custom featurizers, custom models).

##### Architectural Patterns & Principles
- Layered Architecture:
– Foundation: deepchem.utils
– Data Layer: deepchem.data, deepchem.splits, deepchem.trans
– Featurization Layer: deepchem.feat
– Model Layer: deepchem.models, deepchem.rl, deepchem.dock, deepchem.metalearning
– Orchestration: deepchem.hyper, deepchem.molnet, examples/ scripts
- Plugin-Style Extensibility: modules expose base-class interfaces for custom featurizers, models, splitters, optimizers.
- Separation of Concerns: data I/O, featurization, model abstraction, training logic, evaluation logic are all decoupled.
- Multi-Backend Strategy: abstract “Model” interface implemented by TensorFlow, PyTorch, JAX, scikit-learn, GBDT, enabling users to switch frameworks.

##### Elements
– Contrib/examples in another.
– External frameworks/services in a third (e.g., Docker, CI, GPU).
- Annotations for patterns:
– “Model abstraction layer” bridging frameworks.
– “Plugin interface” at featurizer & optimizer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Flow
    datasets["datasets/"]:::aux -->|"raw data"| data["deepchem.data"]:::core
    data -->|"SMILES/SDF→Tensor"| feat["deepchem.feat"]:::core
    feat -->|"features→tensors"| models["deepchem.models"]:::core
    models -->|"predictions→metrics"| metrics["deepchem.metrics"]:::core

    %% Orchestration & Extensions
    feat -->|"features→env"| rl["deepchem.rl"]:::core
    feat -->|"structures→dock"| dock["deepchem.dock"]:::core
    models -->|"training loop"| hyper["deepchem.hyper"]:::core
    models -->|"meta-update"| metalearning["deepchem.metalearning"]:::core
    data -->|"splits/transforms"| splits["deepchem.splits"]:::core
    data --> splits
    splits --> trans["deepchem.trans"]:::core
    data & models & metrics -->|"benchmark"| molnet["deepchem.molnet"]:::core

    %% Auxiliary Directories
    contrib["contrib/"]:::aux -->|"plugins to"| feat
    contrib --> models
    examples["examples/"]:::aux -->|"end-to-end"| molnet
    docs["docs/"]:::aux
    docker["docker/"]:::aux
    ci[".github/workflows"]:::aux

    %% External Dependencies
    subgraph "External Dependencies"
        tf["TensorFlow"]:::external
        torch["PyTorch"]:::external
        jax["JAX"]:::external
        rdkit["RDKit"]:::external
        scipy["SciPy/NumPy/pandas"]:::external
    end
    tf --> models
    torch --> models
    jax --> models
    rdkit --> utils["deepchem.utils"]:::core
    scipy --> utils

    %% Layers Groups
    subgraph "Library Core"
        data
        feat
        models
        rl
        dock
        hyper
        metalearning
        splits
        trans
        molnet
        metrics
        utils
    end

    subgraph "Auxiliary & Infrastructure"
        contrib
        examples
        docs
        docker
        ci
    end

    %% Click Events
    click data "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/data/"
    click feat "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/feat/"
    click models "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/models/"
    click molnet "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/molnet/"
    click dock "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/dock/"
    click rl "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/rl/"
    click hyper "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/hyper/"
    click metalearning "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/metalearning/"
    click metrics "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/metrics/"
    click splits "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/splits/"
    click trans "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/trans/"
    click utils "https://github.com/bhuvanmdev/deepchem/tree/master/deepchem/utils/"
    click contrib "https://github.com/bhuvanmdev/deepchem/tree/master/contrib/"
    click datasets "https://github.com/bhuvanmdev/deepchem/tree/master/datasets/"
    click examples "https://github.com/bhuvanmdev/deepchem/tree/master/examples/"
    click docs "https://github.com/bhuvanmdev/deepchem/tree/master/docs/"
    click docker "https://github.com/bhuvanmdev/deepchem/tree/master/docker/"
    click ci "https://github.com/bhuvanmdev/deepchem/tree/master/.github/workflows"

    %% Styles
    classDef core fill:#b3cde3,stroke:#4b6480,color:#000;
    classDef aux fill:#fddaec,stroke:#c2185b,color:#000;
    classDef external fill:#ccebc5,stroke:#238b45,color:#000;
```
