Multivariate hawkes#92
Conversation
- Added mark distribution to the process
- Added `univariate_process.jl` and `multivariate_process.jl` files defining the common interfaces - Updated the multivariate processes to comply with the interface - Split univariate Hawkes implementation into thre files
|
|
||
| Apply the time rescaling `t -> Λ(t)` to history `h`. | ||
| """ | ||
| function time_change end No newline at end of file |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function time_change end | |
| function time_change end | |
| function log_intensity(pp::AbstractMultivariateProcess, m, t, h::History) | ||
| return [log_intensity(pp, m, t, h, d) for d in 1:ndims(pp)] | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| # parameters in normalized space (') relate to original by μ0=μ'*(n/tmax), ω0=ω'*(n/tmax), α0=(ψ'ω')*(n/tmax) | ||
| return HawkesProcess(μ * (n / tmax), ψ * ω * (n / tmax), ω * (n / tmax), mark_dist) | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| mark_dist::D | ||
|
|
||
| function HawkesProcess(μ::T1, α::T2, ω::T3) where {T1,T2,T3} | ||
| function HawkesProcess(μ::T1, α::T2, ω::T3, mark_dist::D) where {T1,T2,T3<:Real,D<:PointProcessMarkDistribution} |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function HawkesProcess(μ::T1, α::T2, ω::T3, mark_dist::D) where {T1,T2,T3<:Real,D<:PointProcessMarkDistribution} | |
| function HawkesProcess( | |
| μ::T1, α::T2, ω::T3, mark_dist::D | |
| ) where {T1,T2,T3<:Real,D<:PointProcessMarkDistribution} |
|
|
||
| Base.ndims(::AbstractUnivariateProcess) = 1 | ||
|
|
||
| mark_distribution(pp::AbstractUnivariateProcess, t, h) = mark_distribution(pp.mark_dist, t, h) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| mark_distribution(pp::AbstractUnivariateProcess, t, h) = mark_distribution(pp.mark_dist, t, h) | |
| function mark_distribution(pp::AbstractUnivariateProcess, t, h) | |
| mark_distribution(pp.mark_dist, t, h) | |
| end |
| function time_change(h::History, pp::AbstractUnivariateProcess) | ||
| Λ(t) = integrated_ground_intensity(pp, h, min_time(h), t) | ||
| return time_change(h, Λ) | ||
| end No newline at end of file |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| end | |
| end | |
| @test isa(fit(HawkesProcess, h_big), HawkesProcess{BigFloat}) | ||
| @test isa(fit(HawkesProcess{Float32}, h_big), HawkesProcess{Float32}) | ||
| @test isa(fit(HawkesProcess{BigFloat,NoMarks}, h_big), HawkesProcess{BigFloat}) | ||
| @test isa(fit(HawkesProcess{Float64,Normal}, h_sim2), HawkesProcess{Float64,Normal{Float64}}) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| @test isa(fit(HawkesProcess{Float64,Normal}, h_sim2), HawkesProcess{Float64,Normal{Float64}}) | |
| @test isa( | |
| fit(HawkesProcess{Float64,Normal}, h_sim2), HawkesProcess{Float64,Normal{Float64}} | |
| ) |
| @test mark_distribution(md, 0.0, h) == Normal(1.0) | ||
| @test eltype(md) == Float64 | ||
| @test densityof(md, 0.0, h, 0.0) == densityof(Normal(1.0), 0.0) | ||
| end No newline at end of file |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| end | |
| end | |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This PR has the objective of implementing multivariate Hawkes processes.
In the process, some other modifications were carried out.
AbstractUnivariateProcessandAbstractMultivariateProcess