Skip to content

Commit

Permalink
Fix ambiguous methods for codify (#431)
Browse files Browse the repository at this point in the history
* Remove explicit methods for `codify` for `AbstractStateSpaceSet`

* Up version
  • Loading branch information
kahaaga authored Nov 16, 2024
1 parent 87f97d6 commit 7fd09b5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "ComplexityMeasures"
uuid = "ab4b797d-85ee-42ba-b621-05d793b346a2"
authors = "Kristian Agasøster Haaga <[email protected]>, George Datseries <[email protected]>"
repo = "https://github.com/juliadynamics/ComplexityMeasures.jl.git"
version = "3.7.2"
version = "3.7.3"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
8 changes: 1 addition & 7 deletions src/core/encodings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ export codify
"""
codify(o::OutcomeSpace, x::Vector) → s::Vector{Int}
codify(o::OutcomeSpace, x::AbstractStateSpaceSet{D}) → s::NTuple{D, Vector{Int}
Codify `x` according to the outcome space `o`.
If `x` is a `Vector`, then a `Vector{<:Integer}` is returned. If `x` is a
`StateSpaceSet{D}`, then symbolization is done column-wise and an
`NTuple{D, Vector{<:Integer}}` is returned, where `D = dimension(x)`.
## Description
Expand All @@ -69,6 +65,4 @@ spaces preserve the input data length (e.g. [`UniqueElements`](@ref)), while
some outcome spaces (e.g. [`OrdinalPatterns`](@ref)) do e.g. delay embeddings before
encoding, so that `length(s) < length(x)`.
"""
function codify(o::OutcomeSpace, s::AbstractStateSpaceSet)
return map(x -> codify(o, x), columns(s))
end
function codify(o::OutcomeSpace, x) end
2 changes: 1 addition & 1 deletion src/outcome_spaces/ordinal_patterns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function fasthist!(πs::Vector{Int}, est::OrdinalOutcomeSpace{m}, x::AbstractSta
return cts
end

function codify(o::OrdinalOutcomeSpace{m}, x::AbstractVector{<:Real}) where {m}
function codify(o::OrdinalOutcomeSpace{m}, x::AbstractVector) where {m}
emb = embed(x, m, o.τ).data
return encode.(Ref(o.encoding), emb)
end
Expand Down
2 changes: 1 addition & 1 deletion src/outcome_spaces/value_binning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function codify(o::ValueBinning{<:FixedRectangularBinning}, x::AbstractStateSpac
return encode.(Ref(encoder), x.data)
end

function codify(o::ValueBinning{<:RectangularBinning}, x::AbstractVector{<:Real})
function codify(o::ValueBinning{<:RectangularBinning}, x::AbstractVector)
encoder = RectangularBinEncoding(o.binning, x)
return encode.(Ref(encoder), x)
end
Expand Down
3 changes: 0 additions & 3 deletions test/outcome_spaces/implementations/permutation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,4 @@ end
s = StateSpaceSet(x, y)
c1 = codify(S(), x)
@test c1 isa Vector{Int}
out = codify(S(), s)
@test out isa Tuple
@test out[1] == c1
end

0 comments on commit 7fd09b5

Please sign in to comment.