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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| torchpwl-0.2.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchpwl-0.2.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 15.1 kB
Release files / torchpwl-0.2.0.tar.gz
| Download URL | torchpwl-0.2.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ac32f3cfff48e8d6a0b2ff0da8a7cd8daa8ccfd2874536c257c60e185379a2e
|
|
BLAKE2b-256 checksum How to use checksums |
0ce515d1dfad1667c16c39a317a02c5da4800919704bd23dcf9d340e7c374cbf
|
| 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.2.0-py2-none-any.whl
| Download URL | torchpwl-0.2.0-py2-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
1de62bc3bdda1e5be5a16fbd1b37f8e47d4481deda102e4861296d0471557692
|
|
BLAKE2b-256 checksum How to use checksums |
96715a1ee08ad548b8d782e27ce1cf8225c6f41b3aa7681b03a6d5679bda42cb
|
| 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
|