borch

Deep Universal Probabilistic Programming Language

https://gitlab.com/desupervised/borch

Science Score: 41.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.9%) to scientific vocabulary

Keywords

neural networks ppl probabilistic programming uncertainty uppl
Last synced: 6 months ago · JSON representation ·

Repository

Deep Universal Probabilistic Programming Language

Basic Info
  • Host: gitlab.com
  • Owner: desupervised
  • License: apache-2.0
  • Default Branch: master
Statistics
  • Stars: 4
  • Forks: 1
  • Open Issues: 3
  • Releases: 0
Topics
neural networks ppl probabilistic programming uncertainty uppl
Created almost 5 years ago
Metadata Files
Readme Contributing License Code of conduct Citation Codeowners

README.md

Borch

pipeline status coverage report lifecycle Code style: black docs arXiv

Getting Started | Documentation | Contributing

Borch is a universal probabilistic programming language (PPL) framework developed by Desupervised, that uses and integrates with PyTorch. Borch was designed with special attention to support Bayesian neural networks in a native fashion. Further, it's designed to

  • Flexible and scalable framework
  • Support neural networks out of the box.
  • Have bells and whistles a universal PPL needs.

It can be installed with

sh pip install borch

Usage

See our full tutorials here.

As a quick example let's look into how the neural network interface looks. The module borch.nn provides implementations of neural network modules that are used for deep probabilistic programming and provides an interface almost identical to the torch.nn modules. In many cases it is possible to just switch

python import torch.nn as nn

to

python import borch.nn as nn

and a network defined in torch is now probabilistic, without any other changes in the model specification, one also need to change the loss function to infer.vi.vi_loss.

For example, a convolutional neural network can be written as

```python import torch import torch.nn.functional as F from borch import nn

class Net(nn.Module): def init(self): super(Net, self).init() self.conv1 = nn.Conv2d(1, 6, 5) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10)

def forward(self, x):
    x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))
    x = F.max_pool2d(F.relu(self.conv2(x)), 2)
    x = x.view(-1, self.num_flat_features(x))
    x = F.relu(self.fc1(x))
    x = F.relu(self.fc2(x))
    x = self.fc3(x)
    return x

def num_flat_features(self, x):
    size = x.size()[1:]
    num_features = 1
    for s in size:
        num_features *= s
    return num_features

```

Installation

Borch can be installed using

sh pip install borch

Docker

The Borch Docker images are available as both CPU and GPU versions at gitlab.com/desupervised/borch/container_registry. The latest CPU images can be used as

sh docker run registry.gitlab.com/desupervised/borch/cpu:master

Contributing

Please read the contribution guidelines in CONTRIBUTING.md.

Citation

If you use this software for your research or business please cite us and help the package grow!

text @misc{belcher2022borch, title = {Borch: A Deep Universal Probabilistic Programming Language}, author = {Belcher, Lewis and Gudmundsson, Johan and Green, Michael}, year = 2022, publisher = {arXiv}, doi = {10.48550/ARXIV.2209.06168}, url = {https://arxiv.org/abs/2209.06168}, copyright = {Creative Commons Attribution 4.0 International}, keywords = {Artificial Intelligence (cs.AI), Machine Learning (cs.LG), Programming Languages (cs.PL), FOS: Computer and information sciences, FOS: Computer and information sciences} }

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  Borch: A Deep Universal Probabilistic Programming
  Language
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Lewis
    family-names: Belcher
    email: lb@desupervised.io
    affiliation: Desupervised
    orcid: 'https://orcid.org/0000-0001-9680-078X'
  - given-names: Michael
    family-names: Green
    email: mg@desupervised.io
    affiliation: Desupervised
    orcid: 'https://orcid.org/0000-0003-1507-1613'
  - given-names: Johan
    family-names: Gudmundsson
    email: jg@desupervised.io
    affiliation: Desupervised
    orcid: 'https://orcid.org/0000-0002-7316-0334'
identifiers:
  - type: doi
    value: 10.48550/arXiv.2209.06168
    description: The ArXiv deposit of the encompassing paper.
  - type: url
    value: 'https://borch.readthedocs.io'
    description: Documentation of the software package.
repository-code: 'https://gitlab.com/desupervised/borch'
abstract: >-
  Borch is a scalable and flexible deep universal
  probabilistic programming language built on top of
  PyTorch. It enables deep learning practitioners to
  swiftly and easily enable uncertainty
  quantification in all predictions for all types of
  deep neural network architectures.
keywords:
  - borch
  - deep learning
  - probabilistic programming
  - deep universal probabilistic programming
  - pytorch
  - bayesian
license: Apache-2.0
version: 0.2.0
date-released: '2022-09-14'

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 2,365
  • Total Committers: 11
  • Avg Commits per committer: 215.0
  • Development Distribution Score (DDS): 0.4
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Johan Gudmundsson j****n@g****m 1,420
Lewis l****s@d****o 306
Lewis Belcher b****s@p****m 291
Mathias Schreiner m****r@g****m 224
Praveen Agre p****e@k****m 59
Michael Green m****n@g****m 37
Mathias Schreiner m****s@m****e 10
Jacob Mathias Schreiner j****s@d****o 6
Jinnapat Mind Indrapiromkul ji@d****o 5
Johan Book j****k@d****o 5
Johan Book j****k@d****o 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

docs/requirements.txt pypi
  • torch *
docs/requirements_geometric.txt pypi
  • torch-geometric *
  • torch-scatter *
  • torch-spline-conv *
setup.py pypi
  • numpy >=1.17.5
  • scipy >=1.2.0
  • torch >=1.8.0