Skip to main content

Piecewise Linear Functions (PWLs) can be used to approximate any 1D function. PWLs are built with a configurable number of line segments - the more segments the more accurate the approximation. This package implements PWLs in PyTorch and as such they can be fit to the data using standard gradient descent. For example:

import torchpwl

# Create a PWL consisting of 3 segments for 5 features - each feature will have its own PWL function. pwl = torchpwl.PWL(num_features=5, num_breakpoints=3) x = torch.Tensor(11, 5).normal_() y = pwl(x)

Monotonicity is also supported via MonoPWL. See the class documentations for more details.

Release files for torchpwl 0.1.2

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

Source distribution (sdist)

Source distribution for torchpwl 0.1.2
File Size Uploaded
torchpwl-0.1.2.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torchpwl 0.1.2
File Interpreter ABI Platform
torchpwl-0.1.2-py2-none-any.whl Python 2 none any Details

Total release size: 14.7 kB

Release files / torchpwl-0.1.2.tar.gz

Download URL torchpwl-0.1.2.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
46ba43df266bd6df2e4d2b255e1b7ba9e1e4a91bb766916e0c00cc2140288512
BLAKE2b-256 checksum
How to use checksums
ca414ce4308a231ff2222e5718fbdc494bc7ded2fd2f20066f1b126bea4132cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

Release files / torchpwl-0.1.2-py2-none-any.whl

Download URL torchpwl-0.1.2-py2-none-any.whl
Size 7.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
d332e1a289c4bd0c745f5f259b18b88ea751fa3ab592fff27dc5d379088992f6
BLAKE2b-256 checksum
How to use checksums
215c5cd353147a00f4cc28f097b639b018430b24adc5a1aa6be6d65130d4e272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.2 This release

2 release files

0.1.0

2 release files

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