Skip to content

tiwalayo/monotonic-mlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Monotonic MLP

Implementation of the monotonic multi-layer perceptron, as described in Monotonic Networks (Sill, 1998).

It's very simple to import and implement, since in some sense a monotonic network's first layer is the most critical. Here's an example vanilla implementation:

import torch
import torch.nn as nn
from sillmmlp.monotonic import MonotonicLinear, MonotonicGroup, MonotonicMax, MonotonicMin

class MonotonicNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.m1 = MonotonicLinear(nn.ModuleList([MonotonicGroup(1, 100) for i in range(100)]))
        self.m2 = MonotonicMax()
        self.m3 = MonotonicMin()

    def forward(self, x):
        x = self.m1(x)
        x = self.m2(x)
        x = self.m3(x)
        return x

About

Implementation of monotonic multi-layer perceptron

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages