StatsDiscretizations.jl

Author nignatiadis
Popularity
1 Star
Updated Last
7 Months Ago
Started In
March 2021

StatsDiscretizations

Build Status Coverage

Julia package to simplify discretization operations that are routine in statistical tasks. The key idea of the package is that a lot of statistical operations can be simplified by giving first class support to Intervals from the IntervalSets.jl package.

Discretizers

Let ℐ the set of all intervals on ℝ. The key idea is that a discretizer acts as a function from ( subset of ) ℝ ∪ ℐ ↦ ℐ with the following properties:

  • Callable as discretizer(z) and broadcastable discretizer.(zs).
  • Returns intervals: typeof(discretizer(z)) <: AbstractInterval.
  • Idempotent: discretizer(discretizer(z)) == discretizer(z).

The discretizers that are currently implemented are the following

RealLineDiscretizer{:open,:closed}(grid), RealLineDiscretizer{:closed,:open}(grid)

This is a discretizer that partitions the whole real line into intervals with breakpoints at grid. For example:

julia> using StatsDiscretizations
julia> discr = RealLineDiscretizer{:open,:closed}(-2:0.1:2)

julia> discr(-5)
-Inf..-2.0 (open–closed)

julia> discr(0.05)
0.0..0.1 (open–closed)

julia> discr(0.00)
-0.1..0.0 (open–closed)