Skip to main content

A Python framework for AI-powered hazard prediction and risk assessment

Project description

PyHazards logo

PyHazards: A Python framework for AI-powered hazard prediction

Datasets · Models · Benchmarks · Training Pipelines · Evaluation

PyPI version Build status License GitHub stars GitHub forks

Documentation · GitHub · Slack

Overview

PyHazards is built for hazard-AI work that needs more than a single model or paper reproduction. It unifies dataset discovery, model construction, benchmark-aligned evaluation, and experiment plumbing so the same library can support first-run baselines, comparative studies, and contributor extensions.

Intended users:

  • Researchers: run benchmark-aligned experiments and compare baselines across hazard tasks.
  • Practitioners: reuse hazard-specific workflows for data inspection, model building, and evaluation.
  • Contributors: extend datasets, models, and benchmarks through registry and catalog patterns already used in the repo.

Why PyHazards

  • Unified datasets: public hazard datasets, forcing sources, and inspection entrypoints live in one curated catalog.
  • Benchmark-aligned evaluation: shared benchmark families, smoke configs, and reports keep experiments comparable.
  • Registry-based models: published baselines and adapters are built through a consistent model-registry surface.
  • Shared training and inference pipelines: one engine layer supports fit, evaluate, predict, and benchmark execution workflows.

Hazard Coverage

  • Wildfire: danger forecasting, weekly forecasting, spread baselines, fuels, burn products, and active-fire sources.
  • Earthquake: waveform picking, dense-grid forecasting adapters, and linked benchmark ecosystems for picking and forecasting.
  • Flood: streamflow and inundation baselines with benchmark-backed evaluation paths.
  • Tropical Cyclone: track-and-intensity forecasting baselines plus shared benchmark ecosystems and adapters.

Installation

Install PyHazards from PyPI:

pip install pyhazards

If you need GPU execution, install a compatible PyTorch build first and then select the device as needed:

export PYHAZARDS_DEVICE=cuda:0

Quick Start

Use this as the shortest benchmark-aware starter path: verify the package, build one registered model, and run one smoke benchmark config.

  1. Verify the installation:
python -c "import pyhazards; print(pyhazards.__version__)"
  1. Build a registered model:
from pyhazards.models import build_model

model = build_model(
    name="hydrographnet",
    task="regression",
    node_in_dim=2,
    edge_in_dim=3,
    out_dim=1,
)
print(type(model).__name__)
  1. Run a benchmark-aligned smoke configuration:
python scripts/run_benchmark.py --config pyhazards/configs/flood/hydrographnet_smoke.yaml
  1. Continue with the full docs for dataset inspection, benchmark pages, and training workflows.

Project Structure

  • pyhazards.datasets - dataset catalog, registry surfaces, and inspection entrypoints.
  • pyhazards.models - model registry, builders, and reusable baseline implementations.
  • pyhazards.benchmarks - benchmark families, ecosystem mappings, and evaluation contracts.
  • pyhazards.engine - shared training, inference, runner, and experiment utilities.
  • pyhazards.configs - smoke and example benchmark configurations.
  • docs/ and docs/source/ - published documentation, generated catalogs, and contributor guides.

Supported Workflows

  • inspect hazard datasets and forcing sources before training,
  • build baseline and adapter models through the unified registry,
  • run smoke tests and benchmark configs for hazard-specific tasks,
  • export benchmark reports and compare metrics across models,
  • extend the library with new datasets, models, benchmarks, and catalog entries.

Documentation

Full documentation: https://labrai.github.io/PyHazards

Recommended reading order:

  1. Installation
  2. Quick Start
  3. Datasets
  4. Models
  5. Benchmarks
  6. Implementation Guide

Contributing

If you want to extend PyHazards:

Roadmap themes:

  • more benchmark ecosystems and external data adapters,
  • more hazard-specific baselines and evaluation coverage,
  • expanded reproducibility, report tooling, and smoke-test coverage,
  • stronger examples, tutorials, and contributor automation.

Community

Project activity:

Star History Chart

Citation

If you use PyHazards in your research, please cite:

@misc{pyhazards2025,
  title        = {PyHazards: An Open-Source Library for AI-Powered Hazard Prediction},
  author       = {Cheng et al.},
  year         = {2025},
  howpublished = {\url{https://github.com/LabRAI/PyHazards}},
  note         = {GitHub repository}
}

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhazards-1.0.6.tar.gz (60.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhazards-1.0.6-py3-none-any.whl (60.3 MB view details)

Uploaded Python 3

File details

Details for the file pyhazards-1.0.6.tar.gz.

File metadata

  • Download URL: pyhazards-1.0.6.tar.gz
  • Upload date:
  • Size: 60.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for pyhazards-1.0.6.tar.gz
Algorithm Hash digest
SHA256 6d3977dab8eaeb72e7ec60253f1770ad13f61ef7329216ac5cb1f8aadecf8587
MD5 16bac3767ac44c5ca475e7b95c6252d5
BLAKE2b-256 9202e21c773607addae5e7188e0dbcece3fa0a59c6b3d5c069a1fda3a85bed77

See more details on using hashes here.

File details

Details for the file pyhazards-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyhazards-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 60.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for pyhazards-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e0d42b9175a315a9e490f2008e1c0468514b34ea6965282505539fb7fc7e002c
MD5 b186336b75594a3d2b0dadd9511db0d7
BLAKE2b-256 e0bea64d30b9ad268abe36a8af85e6851a47b8c708a45a102f736ab9caeb2984

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page