-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDecayFunctions.py
More file actions
45 lines (35 loc) · 1.07 KB
/
Copy pathDecayFunctions.py
File metadata and controls
45 lines (35 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
__author__ = 'tjohnson'
import math
class ExponentialDecayFunction:
"""
Exponential decay function from Liniger thesis p. 32
"""
def __init__(self,params):
self.setParams(params)
self.epsilon=1e-5 #For Q function
@staticmethod
def getNumParameters():
return 1
@staticmethod
def getParameterBounds():
return [[1e-5,None]]
def setParams(self,params):
"""
Set parameters with an iterable to support log-likelihood calculation
This will set alpha=params[0]
"""
self.alpha=params[0]
def getW(self,t):
"""
Get value of decay function
:param componentIdx: Index of multivariate process component
:param t: Time
:return: Value of decay function w
"""
return self.alpha*math.exp(-self.alpha*t)
def getWBar(self,t):
"""Get value of cumulative decay function"""
return 1.0-math.exp(-self.alpha*t)
def getQ(self):
"""Get value of quantile function"""
return -math.log(self.epsilon)/self.alpha