Skip to content

Struct for mark distributions #80

@JoseKling

Description

@JoseKling

The current implementations only account for mark distributions that are independent from the event times. This is mainly focused on using Distributions.jl as mark distributions.
There are some obvious limitations to that and it is also a bit cumbersome at times. Some issues:

  • It is not straightforward to use a PoissonProcess with a mark distribution that depends on time or the history
  • Using the Dirac(nothing) for unmarked processes is annoying and not intuitive. It has no logdensityof method, which breaks some methods.

My idea is to add a AbstractMarkDistribution that can be easily extended and implements the necessary interface independently of the process. We could have things like

abstract type AbstractMarkDistribution end

sample_mark(md::AbstractMarkDistribution, h, t) = rand(md.mark_dist)
DensityInterface.densityof(md::FixedDistribution, h, t, m) = densityof(mark_distribution(md.mark_dist, h, t), m)

# Replaces `Dirac(nothing)` 
struct NoMarks <: AbstractMarkDistribution end

mark_distribution(md::NoMarks, t , h) = Dirac(nothing)
DensityInterface.densityof(md::NoMarks, h, t, nothing) = 1.0 # Fix density issue

# Works with distributions from Distribution.jl
struct FixedDistribution{D} <: AbstractMarkDistribution 
    mark_dist::D
end

mark_distribution(m::FixedDistribution, h, t) = m.mark_dist()

# Easily extend to other cases
struct NonStationaryNormalDistribution{R<:Real} <: AbstractMarkDistribution
    a::R
    b::R
end
mark_distribution(md::NonStationaryNormalDistribution, t , h) = Normal( a * t + b)

would require a bit more thought on the interface, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions