How mims-harvard/tdc works
Project Purpose and Type
• PyTDC is an open-source machine-learning platform built for therapeutics, integrating heterogeneous, continuously updated biomedical data with state‐of‐the‐art models for training, evaluation, and inference.
• Its API-first design, microservice architecture, and modular “Problem – Learning Task – Dataset” structure are important; it handles single-instance prediction, multi-instance prediction, and generation tasks.
Main Components
• Data Sources & Ingestion:
– External data sources (e.g., Harvard Dataverse, continuously updated datasets).
– Built-in dataset configuration modules (folder: tdc/dataset_configs) that manage dataset information.
• Core API & Data Loaders:
– Hierarchical “Problem → Learning Task → Dataset” structure.
– Data loader APIs and functions (e.g., in tdc/single_pred, tdc/multi_pred, tdc/generation) that provide structured access to the datasets.
• Data Functions & Utilities:
– Chemical utilities (tdc/chem_utils), feature generators (tdc/feature_generators), and miscellaneous utilities (tdc/utils) that process and transform data.
• Model Server & Inference:
– Model server components (tdc/model_server) including model loaders, tokenizers, and inference endpoints.
• Evaluation & Benchmarking:
– Evaluation modules and benchmark groups (both in the tdc subdirectories and examples) that cover tasks like data splitting, performance metrics, and leaderboards.
• Oracles for Molecule Generation:
– Oracles and generative utilities (see modules within tdc/generation and examples/generation) for goal-directed and distribution-learning tasks.
• CI/CD, Documentation, and Testing:
– Build and test configurations (.circleci, .github workflows, pre-commit, RTD configuration) indicating automated testing, code quality, and continuous documentation.
– Extensive documentation (docs folder) and tutorials (tutorials directory) to showcase usage and workflows.
Relationships and Interactions Between Components
• Data Flow:
– External data sources feed into dataset configuration modules that “ingest” data into the system.
– Data loaders (via the API) then deliver this organized data to the specific learning tasks (single_pred, multi_pred, generation).
• Processing Flow:
– Utility components (chem_utils, feature_generators, data functions, etc.) process the raw data and support tasks like splitting and featurization.
– The processed data is then passed on to models (via the model server, tokenizers, and loaders), where training/inference happens.
• Evaluation Flow:
– Once models are run, evaluation modules (evaluators, benchmark groups, oracles) capture performance metrics.
– These are used to update leaderboards and benchmarks.
• Deployment & Continuous Integration:
– CI/CD pipelines execute tests, quality checks, and documentation builds, ensuring reliable and reproducible workflows.
– The system server (model_server) also exposes inference endpoints for production use.
Architectural Patterns and Design Principles
• API-First Design: Emphasizes that every dataset and learning task is available via high-level API calls.
• Modular/MVC Patterns: There’s a clear separation between the “models/view” (data loaders, oracles) and the underlying “controller” functions in utilities and evaluators.
• Microservice-Like Structure: Components like the model server interact with independently managed datasets and external repositories.
• Hierarchical Organization: Three-tier design – problems, learning tasks, and datasets – provides clarity in user workflows and extensions.
Technologies and Frameworks
• Python and its ecosystem (numpy, pandas, scikit-learn, etc.) serve as the primary technology.
• CI/CD tooling by CircleCI and GitHub Actions for orchestration.
• Documentation tools like ReadTheDocs and Sphinx (docs/conf.py).
• Notebook examples and demo scripts (Jupyter notebooks in tutorials and examples) to illustrate the system usage.