{"id":37072195,"url":"https://github.com/scbirlab/duvida","last_synced_at":"2026-01-14T08:28:27.116Z","repository":{"id":284219285,"uuid":"954201492","full_name":"scbirlab/duvida","owner":"scbirlab","description":"🧐 Calculating exact and approximate confidence and information metrics for deep learning on general purpose and chemistry tasks.","archived":false,"fork":false,"pushed_at":"2025-10-15T21:26:44.000Z","size":22685,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T08:23:46.676Z","etag":null,"topics":["active-learning","ai","chemistry","confidence-estimation","confidence-intervals","hessian","hessian-vector-product","jax","torch"],"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/scbirlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2025-03-24T18:02:34.000Z","updated_at":"2025-10-15T21:26:39.000Z","dependencies_parsed_at":"2025-06-13T14:27:16.455Z","dependency_job_id":"498891eb-b202-41cb-b416-d871e4082e46","html_url":"https://github.com/scbirlab/duvida","commit_stats":null,"previous_names":["scbirlab/duvida"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/scbirlab/duvida","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scbirlab%2Fduvida","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scbirlab%2Fduvida/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scbirlab%2Fduvida/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scbirlab%2Fduvida/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scbirlab","download_url":"https://codeload.github.com/scbirlab/duvida/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scbirlab%2Fduvida/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:16:59.381Z","status":"ssl_error","status_checked_at":"2026-01-14T08:13:45.490Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["active-learning","ai","chemistry","confidence-estimation","confidence-intervals","hessian","hessian-vector-product","jax","torch"],"created_at":"2026-01-14T08:28:26.290Z","updated_at":"2026-01-14T08:28:27.085Z","avatar_url":"https://github.com/scbirlab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧐 duvida\n\n![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/scbirlab/duvida/python-publish.yml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/duvida)\n![PyPI](https://img.shields.io/pypi/v/duvida)\n\n**duvida** (Portuguese for _doubt_) is a suite of python tools for calculating confidence and information metrics \nfor deep learning. It provides lower-level function transforms for exact and approximate Hessian diagonals \nin JAX and pytorch. \n\n- [Installation](#installation)\n- [Python API](#python-api)\n- [Issues, problems, suggestions](#issues-problems-suggestions)\n- [Documentation](#documentation)\n\n## Installation\n\n### The easy way\n\nYou can install the precompiled version directly using `pip`. You need to specify the machine learning framework\nthat you want to use:\n\n```bash\n$ pip install duvida[jax]\n# or\n$ pip install duvida[jax_cuda12]  # for JAX installing CUDA 12 for GPU support\n# or\n$ pip install duvida[jax_cuda12_local]  # for JAX using a locally-installed CUDA 12\n# or\n$ pip install duvida[torch]\n```\n\nWe have implemented JAX and pytorch functional transformations for approximate and exact Hessian diagonals,\nand doubtscore and information sensitivity. These can be used with JAX- and pytorch-based frameworks.\n\n### From source\n\nClone the repository, then `cd` into it. Then run:\n\n```bash\n$ pip install -e .[torch]\n```\n\n## Python API\n\n**duvida** provides functional transforms for JAX and pytorch that calculate \neither exact or approximate Hessian diagonals.\n\nYou can check which backend you're using:\n\n```python\n\u003e\u003e\u003e from duvida.stateless.config import config\n\u003e\u003e\u003e config\nConfig(backend='jax', precision='double', fallback=True)\n```\n\nIt can be changed:\n\n```python\n\u003e\u003e\u003e config.set_backend(\"torch\")\n'torch'\n\u003e\u003e\u003e config\nConfig(backend='torch', precision='double', fallback=True)\n```\n\nNow you can calculate exact Hessian diagonals without calculating the \nfull matrix:\n\n```python\n\u003e\u003e\u003e from duvida.stateless.utils import hessian\n\u003e\u003e\u003e import duvida.stateless.numpy as dnp \n\u003e\u003e\u003e f = lambda x: dnp.sum(x ** 3. + x ** 2. + 4.)\n\u003e\u003e\u003e a = dnp.array([1., 2.])\n\u003e\u003e\u003e exact_diagonal(f)(a) == dnp.diag(hessian(f)(a))\nArray([ True,  True], dtype=bool)\n```\n\nVarious approximations are also allowed.\n\n```python\n\u003e\u003e\u003e from duvida.stateless.hessians import get_approximators\n\u003e\u003e\u003e get_approximators()  # Use no arguments to show what's available\n('squared_jacobian', 'exact_diagonal', 'bekas', 'rough_finite_difference')\n```\n\nNow apply:\n\n```python\n\u003e\u003e\u003e approx_hessian_diag = get_approximators(\"bekas\")\n\u003e\u003e\u003e g = lambda x: dnp.sum(dnp.sum(x) ** 3. + x ** 2. + 4.)\n\u003e\u003e\u003e a = dnp.array([1., 2.])\n\u003e\u003e\u003e dnp.diag(hessian(g)(a))  # Exact\nArray([38., 38.], dtype=float64)\n\u003e\u003e\u003e approx_hessian_diag(g, n=1000)(a)  # Less accurate when parameters interact\nArray([38.52438307, 38.49679655], dtype=float64)\n\u003e\u003e\u003e approx_hessian_diag(g, n=1000, seed=1)(a)  # Change the seed to alter the outcome\nArray([39.07878869, 38.97796601], dtype=float64)\n```\n\n## Issues, problems, suggestions\n\nAdd to the [issue tracker](https://www.github.com/scbirlab/duvida/issues).\n\n## Documentation\n\n(To come at [ReadTheDocs](https://duvida.readthedocs.org).)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscbirlab%2Fduvida","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscbirlab%2Fduvida","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscbirlab%2Fduvida/lists"}