Metadata-Version: 2.1
Name: torchpwl
Version: 0.1.2
Summary: Implementation of Piecewise Linear Functions (PWL) in PyTorch.
Home-page: https://github.com/PiotrDabkowski/torchpwl
Author: Piotr Dabkowski
Author-email: piodrus@gmail.com
License: MIT
Platform: UNKNOWN
Requires-Dist: torch (>=1.1.0)

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.


