A Quasi-Newton Subspace Trust Region Algorithm for nonmonotone variational inequalities in adversarial learning over box constraints
Project description
QNSTR-Optimizer
QNSTR-Optimizer is a Python implementation of the algorithm proposed in
A Quasi-Newton Subspace Trust Region Algorithm for Nonmonotone Variational Inequalities in Adversarial Learning over Box Constraints.
This package provides a robust and efficient optimizer for solving nonmonotone variational inequality (VI) problems, particularly those arising in adversarial learning and min-max optimization under box constraints. The algorithm leverages a quasi-Newton subspace trust region (QNSTR) approach, offering improved convergence properties for challenging saddle-point and VI problems.
Features
- Quasi-Newton Subspace Trust Region (QNSTR) Algorithm: Efficiently solves nonmonotone VI problems with box constraints.
- PyTorch Integration: Easily integrates as a custom optimizer for PyTorch models.
- Flexible Loss Function: Supports user-defined loss functions for a wide range of applications.
- Reproducible and Extensible: Designed for research and practical use in adversarial learning and related fields.
Installation
We recommend using uv for dependency management:
uv sync
Usage Example
Below is a minimal example demonstrating the use of QnstrOptimizer with a custom loss function in PyTorch:
import torch
from qnstr_optimizer.optimizer import QnstrOptimizer
def loss_fn(x, y):
return x**2 - 5 * x * y - y**2
x = torch.tensor([1.0], requires_grad=False)
y = torch.tensor([1.0], requires_grad=False)
params = [x, y]
optimizer = QnstrOptimizer(
params,
loss_fn,
zeta1=0.1,
zeta2=0.4,
beta1=0.5,
beta2=5,
eta=0.5,
nu=200,
tau=0.9,
epsilon=1e-6,
epsilon_criteria=1e-4,
memory_size=10,
bfgs_dir_count=3,
max_step=100,
mu_s=1e-2,
)
optimizer.step()
assert abs(x.item()) < 0.1 and abs(y.item()) < 0.1
Citation
If you use this code or algorithm in your research, please cite the following paper:
@article{Qiu_2024,
title={A Quasi-Newton Subspace Trust Region Algorithm for Nonmonotone Variational Inequalities in Adversarial Learning over Box Constraints},
volume={101},
ISSN={1573-7691},
url={http://dx.doi.org/10.1007/s10915-024-02679-y},
DOI={10.1007/s10915-024-02679-y},
number={2},
journal={Journal of Scientific Computing},
publisher={Springer Science and Business Media LLC},
author={Qiu, Zicheng and Jiang, Jie and Chen, Xiaojun},
year={2024},
month=oct }
References
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 qnstr_optimizer-0.1.0.tar.gz.
File metadata
- Download URL: qnstr_optimizer-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01d7e5841cf59f82c2dc7b716c13fa6cde171bb313d75d0e47b4bd04c1e428e2
|
|
| MD5 |
a2089039519e4ca05dd70a4af7d637ed
|
|
| BLAKE2b-256 |
d6c2fd5e6b16dc020cb54b5edc6e989bedb4f2afa0748648806a97e1417c9058
|
Provenance
The following attestation bundles were made for qnstr_optimizer-0.1.0.tar.gz:
Publisher:
python-publish.yml on Data2025-code/QNSTR-Optimizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qnstr_optimizer-0.1.0.tar.gz -
Subject digest:
01d7e5841cf59f82c2dc7b716c13fa6cde171bb313d75d0e47b4bd04c1e428e2 - Sigstore transparency entry: 212933418
- Sigstore integration time:
-
Permalink:
Data2025-code/QNSTR-Optimizer@3e700d7cf921bf74f5164ea1bc4dec5adc67ec61 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Data2025-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3e700d7cf921bf74f5164ea1bc4dec5adc67ec61 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qnstr_optimizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qnstr_optimizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16f39c847b2d3228bb58676625d0529064d03a3fa7e9f25cf9b624928efec3dd
|
|
| MD5 |
e0d2832e0e3386d53e2cc0eb52bfb6ad
|
|
| BLAKE2b-256 |
e4373efb4e7089afaf87d04fdcf52b6de331fc3919a03477a86615e31fadc40e
|
Provenance
The following attestation bundles were made for qnstr_optimizer-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on Data2025-code/QNSTR-Optimizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qnstr_optimizer-0.1.0-py3-none-any.whl -
Subject digest:
16f39c847b2d3228bb58676625d0529064d03a3fa7e9f25cf9b624928efec3dd - Sigstore transparency entry: 212933420
- Sigstore integration time:
-
Permalink:
Data2025-code/QNSTR-Optimizer@3e700d7cf921bf74f5164ea1bc4dec5adc67ec61 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Data2025-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3e700d7cf921bf74f5164ea1bc4dec5adc67ec61 -
Trigger Event:
release
-
Statement type: