Learnergy: Energy-based Machine Learners
Learnergy provides PyTorch implementations of Restricted Boltzmann Machines (RBMs) and Deep Belief Networks (DBNs) for unsupervised feature learning, generative modeling, and classification. It also includes dataset adapters, image-quality metrics, and visualization helpers.
Installation
Learnergy requires Python 3.11 or newer.
pip install learnergy
Install the optional torchvision dependency to run the examples:
pip install "learnergy[examples]"
Quick start
import torch
from torch.utils.data import TensorDataset
from learnergy.models.bernoulli import RBM
samples = torch.bernoulli(torch.rand(1_024, 784))
targets = torch.zeros(1_024)
dataset = TensorDataset(samples, targets)
model = RBM(n_visible=784, n_hidden=128, learning_rate=0.1)
mse, pseudo_likelihood = model.fit(dataset, batch_size=128, epochs=5)
reconstruction_mse, reconstructed = model.reconstruct(dataset)
Stack RBMs into a DBN:
from learnergy.models.deep import DBN
model = DBN(
model=("gaussian", "sigmoid"),
n_visible=784,
n_hidden=(256, 128),
steps=(1, 1),
learning_rate=(0.01, 0.01),
momentum=(0, 0),
decay=(0, 0),
temperature=(1, 1),
)
model.fit(dataset, batch_size=128, epochs=(5, 5))
Available models
| Family | Models |
|---|---|
| Bernoulli | RBM, ConvRBM, DiscriminativeRBM, HybridDiscriminativeRBM, DropoutRBM, DropConnectRBM, EDropoutRBM |
| Gaussian | GaussianRBM, GaussianReluRBM, GaussianSeluRBM, VarianceGaussianRBM, GaussianConvRBM |
| Extra | SigmoidRBM |
| Deep | DBN, ConvDBN, ResidualDBN |
The learnergy.core.Dataset, learnergy.math, and learnergy.visual modules
remain available for array-backed datasets, SSIM/scaling helpers, convergence
plots, image mosaics, and tensor rendering.
See examples/applications for complete training and
classification programs.
Development
The repository uses uv for reproducible environments and packaging:
uv sync --locked
uv run pytest
uv build
Citation
@misc{roder2020learnergy,
title={Learnergy: Energy-based Machine Learners},
author={Mateus Roder and Gustavo Henrique de Rosa and João Paulo Papa},
year={2020},
eprint={2003.07443},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Support
Open an issue for bug reports and questions.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file learnergy-2.0.0.tar.gz.
File metadata
- Download URL: learnergy-2.0.0.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c8362008248194c4c6ba4d877be1c66e06f3d6739a52b24c9c2273d13e94339
|
|
| MD5 |
4fa350b0e0090ae942ab8db7e0029872
|
|
| BLAKE2b-256 |
11b40411ba144ff704f4ed6e9e07e65322234ec5aeeca902ddf2d6a2f4cefdcf
|
File details
Details for the file learnergy-2.0.0-py3-none-any.whl.
File metadata
- Download URL: learnergy-2.0.0-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf857f268178cec90e4ab8c7e6ac3ce1c5ca39d38f7021387d551a11bf6188fa
|
|
| MD5 |
132b0d75fa1050c5b11349bc4d162341
|
|
| BLAKE2b-256 |
d454920de122767a078bc28888b02a8b1d0b48a2361bc0809d872b69489d3ba0
|