Skip to content

Instantly share code, notes, and snippets.

@vvksh
Last active October 12, 2021 00:06
Show Gist options
  • Save vvksh/7aa20ff56b6c6e9a415293b95563539c to your computer and use it in GitHub Desktop.
Save vvksh/7aa20ff56b6c6e9a415293b95563539c to your computer and use it in GitHub Desktop.
spark isotonic regression to torch
import torch
from torch import nn
from torchinterp1d import Interp1d
class InterpModule(nn.Module):
def __init__(self, X, y):
super().__init__()
self.X = X
self.y = y
self.interp = Interp1d()
def forward(self, input: torch.Tensor):
return self.interp.forward(self.X, self.y, prediction)
@vvksh
Copy link
Author

vvksh commented Oct 12, 2021

to install

pip install git+git://github.com/aliutkus/torchinterp1d@master

note the latest one depends on torch 1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment