{"id":13738005,"url":"https://github.com/naturalis/sdmdl","last_synced_at":"2026-04-04T05:28:49.570Z","repository":{"id":38627174,"uuid":"192717514","full_name":"naturalis/sdmdl","owner":"naturalis","description":"Species Distribution Modelling using Deep Learning","archived":false,"fork":false,"pushed_at":"2026-03-27T10:51:37.000Z","size":366335,"stargazers_count":26,"open_issues_count":24,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-03-27T22:36:27.071Z","etag":null,"topics":["biodiversity-patterns","deep-learning","dl-sdm","ecological-niche-modelling"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naturalis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-06-19T11:17:00.000Z","updated_at":"2026-03-27T10:42:40.000Z","dependencies_parsed_at":"2023-09-28T18:48:27.747Z","dependency_job_id":"9147e2e7-ef06-47d5-b7ca-0de90343205f","html_url":"https://github.com/naturalis/sdmdl","commit_stats":{"total_commits":596,"total_committers":4,"mean_commits":149.0,"dds":0.4295302013422819,"last_synced_commit":"034ce4e807f7a83d31bf7b46435275ba91cfcb00"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/naturalis/sdmdl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naturalis%2Fsdmdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naturalis%2Fsdmdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naturalis%2Fsdmdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naturalis%2Fsdmdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naturalis","download_url":"https://codeload.github.com/naturalis/sdmdl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naturalis%2Fsdmdl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31389150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biodiversity-patterns","deep-learning","dl-sdm","ecological-niche-modelling"],"created_at":"2024-08-03T03:02:08.726Z","updated_at":"2026-04-04T05:28:49.564Z","avatar_url":"https://github.com/naturalis.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT)\n[![Coverage Status](https://coveralls.io/repos/github/naturalis/sdmdl/badge.svg?branch=master)](https://coveralls.io/github/naturalis/sdmdl?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/sdmdl/badge/?version=latest)](https://sdmdl.readthedocs.io/en/latest/?badge=latest)\n\n# sdmdl — Species Distribution Modelling with Deep Learning\n\nAn object-oriented Python package for species distribution modelling (SDM) using deep neural\nnetworks (DNNs). The package provides an intuitive, high-level interface for exploring biodiversity\npatterns by modelling species' environmental preferences across a large number of abiotic and biotic\nvariables.\n\nTraditional SDM approaches such as [MaxEnt](https://biodiversityinformatics.amnh.org/open_source/maxent/)\nhave well-known limitations in handling correlated input features and incorporating species\ninteractions. **sdmdl** addresses these limitations by using deep learning, which can learn complex,\nnon-linear relationships between environmental predictors and species occurrences. The package\ntrains binary classification DNNs with dropout regularisation, evaluates model performance using AUC\nand bootstrapped confidence intervals, and estimates variable importance using\n[SHAP](https://github.com/slundberg/shap) values.\n\n## Features\n\n- **Data preparation** — Automatically creates presence maps, raster stacks, pseudo-absence\n  samples, band statistics, and training/prediction datasets from occurrence tables and\n  environmental raster layers.\n- **Model training** — Trains multiple DNN replicates per species and retains the best-performing\n  model (highest AUC). Computes feature importance via SHAP.\n- **Prediction** — Generates global species distribution maps as GeoTIFF rasters and PNG\n  visualisations.\n- **Configuration** — All key hyper-parameters (batch size, epochs, layer sizes, dropout, random\n  seed, pseudo-absence sample size) are controlled through a single `config.yml` file.\n\n## Installation\n\n### Prerequisites\n\n[GDAL](https://gdal.org/download.html) must be installed separately as a system dependency,\nincluding the GDAL Python bindings. On Ubuntu/Debian:\n\n```bash\nsudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable\nsudo apt-get update\nsudo apt-get install gdal-bin libgdal-dev\npip install GDAL==$(gdal-config --version)\n```\n\n### Install sdmdl\n\nClone the repository and install in your Python environment:\n\n```bash\ngit clone https://github.com/naturalis/sdmdl.git\ncd sdmdl\npip install .\n```\n\nThe Python dependencies listed in [`requirements.txt`](requirements.txt) will be installed\nautomatically.\n\n## Quick start\n\n```python\nfrom sdmdl.sdmdl_main import sdmdl\n\n# Step 1: Create an sdmdl object pointing to the repository root\nmodel = sdmdl('/path/to/sdmdl')\n\n# Step 2: Prepare data (presence maps, raster stack, pseudo-absences, training \u0026 prediction data)\nmodel.prep()\n\n# Step 3: Train deep neural network models for each species\nmodel.train()\n\n# Step 4: Predict global species distributions\nmodel.predict()\n\n# Step 5: Remove temporary intermediate files\nmodel.clean()\n```\n\n### Input requirements\n\n1. **Environmental raster layers** (`.tif`) placed in:\n   - `data/gis/layers/scaled/` — layers that require standardisation during preprocessing.\n   - `data/gis/layers/non-scaled/` — layers that are already normalised or categorical.\n\n   All raster layers (including the bundled `empty_land_map.tif`) must share the same affine\n   transformation and resolution.\n\n2. **Occurrence tables** (`.csv` or `.xls`/`.xlsx`) placed in `data/occurrences/`. Each table must\n   contain columns named `decimalLatitude` (or `decimallatitude`) and `decimalLongitude` (or\n   `decimallongitude`) with WGS 84 coordinates.\n\n### Configuration\n\nA `config.yml` file is generated automatically on first use in the `data/` directory. It controls:\n\n| Parameter        | Type    | Description                                                  |\n|------------------|---------|--------------------------------------------------------------|\n| `random_seed`    | int     | Seed for reproducibility                                     |\n| `pseudo_freq`    | int     | Number of pseudo-absence samples                             |\n| `batchsize`      | int     | Training batch size                                          |\n| `epoch`          | int     | Number of training epochs                                    |\n| `model_layers`   | list    | Nodes per hidden layer (length sets network depth)           |\n| `model_dropout`  | list    | Dropout rate per hidden layer                                |\n| `verbose`        | bool    | If `True`, display progress bars                             |\n\nChanges to `config.yml` take effect the next time an `sdmdl` object is created.\n\n### Outputs\n\n- **Performance metrics** — `results/_DNN_performance/DNN_eval.txt` with per-species accuracy,\n  loss, AUC, TPR, and confidence intervals.\n- **Trained models** — Per-species `.h5` (weights) and `.json` (architecture) files under\n  `results/\u003cspecies_name\u003e/`.\n- **Feature importance** — SHAP-based feature impact plots (`.png`) per species.\n- **Prediction maps** — GeoTIFF rasters and colour-mapped PNG visualisations of predicted\n  distributions per species.\n\n## Documentation\n\nFull documentation is available on [Read the Docs](https://sdmdl.readthedocs.io/) and in\n[`docs/index.rst`](docs/index.rst).\n\n## Background and references\n\nThis package implements the deep-learning SDM approach described in the following preprint:\n\n\u003e Rademaker, M., Hogeweg, L., \u0026 Vos, R. (2019). *Modelling the niches of wild and domesticated\n\u003e Ungulate species using deep learning.* bioRxiv, 744441.\n\u003e [https://doi.org/10.1101/744441](https://doi.org/10.1101/744441)\n\nA copy of the preprint is included in this repository at [`docs/744441.full.pdf`](docs/744441.full.pdf).\n\n### Related repositories\n\n- [Comparative analysis of abiotic niches in Ungulates](https://github.com/naturalis/trait-geo-diverse-ungulates)\n  by E. Hendrix — the MaxEnt-based comparative analysis that preceded this work.\n- [Ecological Niche Modelling Using Deep Learning](https://github.com/naturalis/trait-geo-diverse-dl)\n  by M. Rademaker — the original proof-of-concept DL-SDM implementation.\n\n### Case study data\n\nThe raw results of a case study on domesticated crops and their wild progenitors are available on\nZenodo:\n- [Environmental raster layers](https://zenodo.org/record/3460541)\n- [Occurrence datasets](https://zenodo.org/record/3460530)\n- [Case study results](https://zenodo.org/record/3460718)\n\n## Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on\nsubmitting bug reports, feature requests, and pull requests.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\nCopyright © 2019 Naturalis Biodiversity Center.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalis%2Fsdmdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaturalis%2Fsdmdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalis%2Fsdmdl/lists"}