Toggle navigation
Ocean Color Science Software
Jump to content
ocssw
V2022
web
ocssw
ocssw_src
src
aquaverse
MDN
transformers
NegLogTransformer.py
Go to the documentation of this file.
1
from
._CustomTransformer
import
_CustomTransformer
2
3
import
numpy
as
np
4
5
6
class
NegLogTransformer
(
_CustomTransformer
):
7
'''
8
Log-like transformation which allows negative values (Whittaker et al. 2005)
9
http://fmwww.bc.edu/repec/bocode/t/transint.html
10
'''
11
def
_transform(self, X, *args, **kwargs):
return
np.
sign
(X) * np.log(np.abs(X) + 1)
12
def
_inverse_transform(self, X, *args, **kwargs):
return
np.
sign
(X) * (np.exp(np.abs(X)) - 1)
13
sign
int sign(double x)
Definition:
proj_cproj.c:340
MDN.transformers.NegLogTransformer.NegLogTransformer
Definition:
NegLogTransformer.py:6
MDN.transformers._CustomTransformer._CustomTransformer
Definition:
_CustomTransformer.py:4