Catch22.jl
API reference for Catch22.jl. For detailed information about the catch22 feature set, see the catch22 wiki and the original publication, Lubba et al. (2019). For further documentation, see TimeseriesFeatures.jl
Catch22.c22
Catch22.c24
Catch22.catch22
Catch22.catch22_raw
Catch22.catch24
Catch22.featuredescriptions
Catch22.featurekeywords
Catch22.DN_HistogramMode_5
Catch22._catch22
TimeseriesFeatures.RAD
TimeseriesFeatures.FeatureArrays.FeatureArray
TimeseriesFeatures.FeatureArrays.FeatureMatrix
TimeseriesFeatures.FeatureArrays.FeatureVector
TimeseriesFeatures.FeatureArrays.featureDims
TimeseriesFeatures.Features.AbstractFeature
TimeseriesFeatures.Features.Feature
TimeseriesFeatures.FeatureSets.FeatureSet
Catch22.c22
— Constantc22
The Catch22 feature set with shortened names; see catch22
.
Catch22.c24
— Constantc24
The Catch24 feature set with shortened names; see catch24
.
Catch22.catch22
— Constantcatch22(𝐱::Vector)
catch22(X::Array)
catch22[featurename::Symbol](X::Array)
Evaluate all features for a time series vector 𝐱
or the columns of an array X
. catch22
is a FeatureSet, which means it can be indexed by feature names (as symbols) to return a subset of the available features. getnames(catch22)
, getkeywords(catch22)
and getdescriptions(catch22)
will also return feature names, keywords and descriptions respectively. Features are returned in a FeatureArray
, in which array rows are annotated by feature names. A FeatureArray
can be converted to a regular array with Array(F)
.
Examples
𝐱 = Catch22.testdata[:test]
𝐟 = catch22(𝐱)
X = randn(100, 10)
F = catch22(X)
F = catch22[:DN_HistogramMode_5](X)
Catch22.catch22_raw
— ConstantThe set of Catch22 features without a preliminary z-score
Catch22.catch24
— Constantcatch24 isa FeatureSet
A feature set containing the mean (DN_Mean
) and standard deviation (DN_Spread_Std
) in addition to all catch22
features. See catch22
.
Catch22.featuredescriptions
— ConstantCatch22.featuredescriptions
A vector listing short descriptions of each feature, as strings.
Catch22.featurekeywords
— ConstantCatch22.featurekeywords
A vector listing keywords of features as vectors of strings.
Catch22.DN_HistogramMode_5
— FunctionDN_HistogramMode_5(x::AbstractVector{Union{Float64, Int}}) # For example
An alternative to catch22(:DN_HistogramMode_5](x)
. All features, such as DN_HistogramMode_5
, are exported as Features and can be evaluated by calling their names.
Examples
𝐱 = Catch22.testdata[:test]
f = DN_HistogramMode_5(𝐱)
Catch22._catch22
— Method_catch22(𝐱::AbstractArray{Float64}, fName::Symbol)
_catch22(fName::Symbol, 𝐱::AbstractArray{Float64})
Evaluate the feature fName
on the single time series 𝐱
. See Catch22.featuredescriptions
for a summary of the 22 available time series features. Time series with NaN or Inf values will produce NaN feature values.
Examples
𝐱 = Catch22.testdata[:test]
Catch22._catch22(𝐱, :DN_HistogramMode_5)
TimeseriesFeatures.RAD
— FunctionRAD(x, τ=1, doAbs=true)
Compute the rescaled auto-density, a metric for inferring the distance to criticality that is insensitive to uncertainty in the noise strength. Calibrated to experiments on the Hopf bifurcation with variable and unknown measurement noise.
Inputs: x: The input time series (vector). doAbs: Whether to centre the time series at 0 then take absolute values (logical flag) τ: The embedding and differencing delay in units of the timestep (integer), or :τ
Outputs: f: The RAD feature value
TimeseriesFeatures.FeatureArrays.FeatureArray
— TypeF = FeatureArray(data::AbstractArray, features::Union{Tuple{Symbol},Vector{Symbol}}, [timeseries::Union{Vector, Tuple}], args...)
Construct a FeatureArray
, which annotates the array data
with names of features
along rows and, optionally, timeseries
along columns. Since FeatureArray <: AbstractFeatureArray <: AbstractDimArray
, further arguments to the FeatureArray
constructor are passed to the DimArray
constructor. To access feature names, use getnames(F)
.
Examples
data = rand(Int, 2, 10) # Some feature matrix with 2 features and 10 timeseries
F = FeatureArray(data, [:sum, :length])
TimeseriesFeatures.FeatureArrays.FeatureMatrix
— TypeFeatureArray{T, 2} where {T}
An alias to construct a FeatureArray
for a flat set of timeseries.
Examples
data = rand(Int, 2, 3) # Some feature matrix with 2 features and 3 timeseries
F = FeatureMatrix(data, [:sum, :length], [1, 2, 3])
TimeseriesFeatures.FeatureArrays.FeatureVector
— TypeFeatureArray{T, 1} where {T}
An alias to construct a FeatureArray
for a single time series.
Examples
data = randn(2) # Feature values for 1 time series
𝐟 = FeatureVector(data, [:sum, :length])
TimeseriesFeatures.FeatureArrays.featureDims
— Methodgetnames(𝒇::FeatureArray)
Get the names of features represented in the feature vector or array 𝒇 as a vector of symbols.
TimeseriesFeatures.Features.AbstractFeature
— TypeAbstractFeature
has a loose interface. Overload (𝑓::AbstractFeature)(x) for different functionality. For compatibility with other TimeseresFeatures
types, define:
Helper methods:
getmethod(𝑓::AbstractFeature)
- `getname(𝑓::AbstractFeature)
- `getkeywords(𝑓::AbstractFeature)
getdescription(𝑓::AbstractFeature)
TimeseriesFeatures.Features.Feature
— Type𝑓 = Feature([;] method::Function, name=Symbol(method), keywords="", description="")
Construct a Feature
, which is a function annotated with a name
, keywords
and short description
. Features can be called as functions while getname(𝑓)
, getkeywords(𝑓)
and getdescription(𝑓)
can be used to access the annotations. The function should have at minimum a method for AbstractVector
. The method on vectors will be applied column-wise to Matrix
inputs, regardless of the function methods defined for Matrix
.
Examples
𝑓 = Feature(sum, :sum, ["distribution"], "Sum of time-series values")
𝑓(1:10) # == sum(1:10) == 55
getdescription(𝑓) # "Sum of time-series values"
TimeseriesFeatures.FeatureSets.FeatureSet
— TypeFeatureSet(methods, [names, keywords, descriptions])
FeatureSet(features::Vector{T}) where {T <: AbstractFeature}
Construct a FeatureSet
from methods
(a vector of functions) and optionally provide names
as a vector of symbols, descriptions
as a vector of strings, and keywords
as a vector of vectors of strings. A FeatureSet
can be called on a time-series vector or matrix X
(with time series occupying columns) to return a FeatureArray
of feature values. Subsets of a FeatureSet
𝒇
can be obtained by indexing with feature names (as symbols) or the regular linear and logical indices. FeatureSet
s also support simple set operations defined for arrays, such as unions and intersections, as well as convenient syntax for concatenation (+
) and set differencing (\
). Note that two features are considered the same (`isequal') if and only if their names are equal.
Examples
𝒇 = FeatureSet([sum, length], [:sum, :length], ["∑x¹", "∑x⁰"], [["distribution"], ["sampling"]])
X = randn(100, 2) # 2 time series, 100 samples long
F = 𝒇(X)
# Joining feature sets
𝒇₁ = FeatureSet([x->min(x...), x->max(x...)], [:min, :max], ["minimum", "maximum"], [["distribution"], ["distribution"]])
𝒈₁ = 𝒇 + 𝒇₁
G = 𝒈₁(X)
# Intersecting feature sets, where features are identified exclusively by their names
𝒇₂ = FeatureSet(x->prod, :sum, "∏x", ["distributions"])
𝒈₂ = 𝒇 ∩ 𝒇₂ # The intersection of two feature sets, both with their own :sum
G = 𝒈₂(X) # The intersection contains the :sum of the first argument to ∩; 𝒇