Skip to main content

This is a PyTorch implementation of the Inter-environmental Gradient Alignment algorithm proposed by Koyama and Yamaguchi in their paper Out-of-Distribution Generalization with Maximal Invariant Predictor

Quick start

Install pytorch-iga in the terminal:

pip install pytorch-iga

Import IGA in python:

from iga import IGA

IGA is defined with the following parameters:

IGA(model, optimizer, criterion, data, num_epochs, batch_size, lamda, verbose=10, device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
)

Parameters:

model (torch.nn.Module): neural network model to be trained/tuned optimizer (torch.optim): pytorch optimizer object such as torch.optim.SGD criterion (function): loss function for model evaluation data (list(torch.utils.Dataset)): a list of Datasets for each environment num_epochs (int): number of training epochs batch_size (int): number of data points per batch lamda (float): importance weight of inter-environmental variance verbose (int): number of iterations in each progress log device (torch.device): optional, torch.device object, defaults to 'cuda' or 'cpu'

Returns:

model (torch.nn.Module): updated torch model IGA_loss (float): ending loss value

Example

to be continued...

Metadata

Release files for pytorch-iga 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytorch-iga 0.0.3
File Size Uploaded Provenance
pytorch-iga-0.0.3.tar.gz 4.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytorch-iga 0.0.3
File Interpreter ABI Platform
pytorch_iga-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / pytorch-iga-0.0.3.tar.gz

Download URL pytorch-iga-0.0.3.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6e43ce378b0d6022f7f99d460beb850d591b29eb32a56efbd99c947d526d2732
BLAKE2b-256 checksum
How to use checksums
8743dc9251e266e68895ff4544e699210696ff77d930c30ce306f3e3c6d1bcc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pytorch_iga-0.0.3-py3-none-any.whl

Download URL pytorch_iga-0.0.3-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa7d83670f3c9d965c6bf58f2f18d7f2fc6197e2d05814fedf097bbe8d704e39
BLAKE2b-256 checksum
How to use checksums
1e6bde1917be8a4381353c7a1c6dcd42d5559c1ca44ddb835c6d5ec4c8f5ce71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for pytorch-iga 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page