-
Notifications
You must be signed in to change notification settings - Fork 4
/
GenuineMultivariateHawkesProcessTest.py
46 lines (38 loc) · 1.52 KB
/
GenuineMultivariateHawkesProcessTest.py
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
46
__author__ = 'tjohnson'
import DecayFunctions
import MarkDistributions
import GenuineMultivariateHawkesProcess
import ImmigrationDescendantParameters
import numpy as np
q=np.matrix("[0.61 0.16;0.60 0.06]")
nu=np.array([0.021,0.029])
alpha=0.015
rho1=5.6
rho2=7.2
mu1=3.6
mu2=4.2
phi1=0.47
phi2=1.1
psi1=0.22
psi2=0.0
immigrationDescendantParameters=\
ImmigrationDescendantParameters.ImmigrationDescendantParameters(2,[0.021,0.029,0.61,0.16,0.6,0.06])
print immigrationDescendantParameters.nu
print immigrationDescendantParameters.q
decayFunction=DecayFunctions.ExponentialDecayFunction([alpha])
markDistribution1=MarkDistributions.ParetoMarkDistribution([mu1,rho1,phi1,psi1,0.0])
markDistribution2=MarkDistributions.ParetoMarkDistribution([mu2,rho2,phi2,psi2,0.0])
hawkesProcess=GenuineMultivariateHawkesProcess.GenuineMultivariateHawkesProcess(
immigrationDescendantParameters,
[decayFunction,decayFunction],
[markDistribution1,markDistribution2])
timeComponentMarkTriples1000=hawkesProcess.simulate(1000)
secondHalfTimeComponentMarkTriples=timeComponentMarkTriples1000[500:]
goodLogLikelihood=hawkesProcess.getLogLikelihood(secondHalfTimeComponentMarkTriples)
print goodLogLikelihood
badDecayFunction=DecayFunctions.ExponentialDecayFunction([alpha])
badLogLikelihood=GenuineMultivariateHawkesProcess.GenuineMultivariateHawkesProcess(
immigrationDescendantParameters,
[badDecayFunction,badDecayFunction],
[markDistribution1,markDistribution2]).getLogLikelihood(secondHalfTimeComponentMarkTriples)
print badLogLikelihood