Skip to content

Multivariate hawkes#92

Draft
JoseKling wants to merge 5 commits into
mainfrom
MultivariateHawkes
Draft

Multivariate hawkes#92
JoseKling wants to merge 5 commits into
mainfrom
MultivariateHawkes

Conversation

@JoseKling

Copy link
Copy Markdown
Owner

This PR has the objective of implementing multivariate Hawkes processes.
In the process, some other modifications were carried out.

  • Split implementation of univariate Hawkes process into three files and added mark distributions
  • Defined separate common interfaces for AbstractUnivariateProcess and AbstractMultivariateProcess

JoseKling added 5 commits May 19, 2026 12:31
- 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
@JoseKling JoseKling mentioned this pull request Jun 2, 2026

Apply the time rescaling `t -> Λ(t)` to history `h`.
"""
function time_change end No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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}

Comment thread src/univariate_process.jl

Base.ndims(::AbstractUnivariateProcess) = 1

mark_distribution(pp::AbstractUnivariateProcess, t, h) = mark_distribution(pp.mark_dist, t, h)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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

Comment thread src/univariate_process.jl
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
end
end

Comment thread test/hawkes.jl
@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}})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
end
end

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.59091% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/multivariate_process.jl 82.35% 3 Missing ⚠️
src/univariate_process.jl 80.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant