Conversation
- Change the models to hold vectors of parameters instead of single
parameters
- Update methods to return multivariate histories
- Update tests
Steps
- Update general interface for `AbstractPointProcess`
- Update `simulation.jl`
- Update homogeneous Poisson and related methods
- Update inhomogeneous Poisson and related methods
- Update hypothesis tests
- They work only for univariate processes. Generalization for the
futrue
- Ignore Hawkes processes, since they will be implemented in another PR
- Takes an array of parameters - Methods like `ground_intensity` return an array - Added methods with an argument `d::Int` to get the values from specific dimensions
This reverts commit 90f08d6. Instead of making all processes multivariate, implement tem separately. - `AbstractMultivariateProcess` - `IndependenteMultivariateProcess` - `DependentMultivariateProcess`? - Other processes, such as `MultivariateHawkesProcess`
|
|
||
| Return the sorted vector of event times for `h` in dimension `d`. | ||
| """ | ||
| event_times(h::History, d::Int) = h.N == 1 && d == 1 ? h.times : (@view h.times[h.dims .== d]) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| event_times(h::History, d::Int) = h.N == 1 && d == 1 ? h.times : (@view h.times[h.dims .== d]) | |
| function event_times(h::History, d::Int) | |
| h.N == 1 && d == 1 ? h.times : (@view h.times[h.dims .== d]) | |
| end |
|
|
||
| Return the vector of event marks in dimension `d` of `h`, sorted according to their event times. | ||
| """ | ||
| event_marks(h::History, d::Int) = h.N == 1 && d == 1 ? h.marks : (@view h.marks[h.dims .== d]) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| event_marks(h::History, d::Int) = h.N == 1 && d == 1 ? h.marks : (@view h.marks[h.dims .== d]) | |
| function event_marks(h::History, d::Int) | |
| h.N == 1 && d == 1 ? h.marks : (@view h.marks[h.dims .== d]) | |
| end |
| if check_args | ||
| @assert h.tmin <= t < h.tmax | ||
| @assert (length(h) == 0) || (h.times[end] <= t) | ||
| @assert (d === nothing && h.N ==1) || 1 <= d <= h.N |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| @assert (d === nothing && h.N ==1) || 1 <= d <= h.N | |
| @assert (d === nothing && h.N == 1) || 1 <= d <= h.N |
| """ | ||
| function Base.append!(h::History, ts::Vector{<:Real}, ms; check=true) | ||
| if check | ||
| function Base.append!(h::History, ts::Vector{<:Real}, ms=fill(nothing, length(ts)), ds=fill(nothing, length(ts)); check_args=true) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function Base.append!(h::History, ts::Vector{<:Real}, ms=fill(nothing, length(ts)), ds=fill(nothing, length(ts)); check_args=true) | |
| function Base.append!( | |
| h::History, | |
| ts::Vector{<:Real}, | |
| ms=fill(nothing, length(ts)), | |
| ds=fill(nothing, length(ts)); | |
| check_args=true, | |
| ) |
| dims = [h1.dims; h2.dims] | ||
| return History(; times=times, tmin=h1.tmin, tmax=h2.tmax, marks=marks, dims=dims, check_args=false) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| dims = [h1.dims; h2.dims] | |
| return History(; times=times, tmin=h1.tmin, tmax=h2.tmax, marks=marks, dims=dims, check_args=false) | |
| dims = [h1.dims; h2.dims] | |
| return History(; | |
| times=times, tmin=h1.tmin, tmax=h2.tmax, marks=marks, dims=dims, check_args=false | |
| ) |
| ) | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| return PoissonProcess(λ, [Dirac(nothing) for _ in eachindex(λ)]) | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
|
|
||
| function PoissonProcess(λ::Vector{R}, mark_dist::D; check_args::Bool=true) where {R<:Real,D} | ||
| return PoissonProcess(λ, [mark_dist for _ in eachindex(λ)]; check_args=check_args) | ||
| end No newline at end of file |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| end | |
| end | |
| `UnivariatePoissonProcess{R}` is simply a type alias for `PoissonProcess{R,Dirac{Nothing}}`. | ||
| """ | ||
| const UnivariatePoissonProcess{R<:Real} = PoissonProcess{R,Dirac{Nothing}} | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| end | ||
| return PoissonProcess(sum(λ), Categorical(λ / sum(λ)); check_args=check_args) | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Implementation of multivariate processes. Discussion in Issue #73
HistoryContains an array
timeswith the event times, an arraymarkswith corresponding marks, and another arraydimswith corresponding dimensionAbstractPointProcessTakes vectors of parameters and mark distributions. Methods such as
ground_intensitynow return a vector, each value corresponding to one dimension.