From 5389ae7fcae65aaff171e887593dfe4999b902a1 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 22 Mar 2019 12:54:44 +0100 Subject: [PATCH] add LogCosh loss --- onn/loss.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/onn/loss.py b/onn/loss.py index 55e94f7..0261303 100644 --- a/onn/loss.py +++ b/onn/loss.py @@ -135,6 +135,16 @@ class Huber(ResidualLoss): self.delta * np.sign(r)) +def LogCosh(ResidualLoss): + # essentially a smooth version of Huber loss. + + def f(self, r): + return np.log(np.cosh(x)) + + def df(self, r): + return np.tanh(r) + + # more class SomethingElse(ResidualLoss):