Comments (3)
This is also the case for Counts
:
julia> c = counts(Dispersion(), rand(50))
Counts{Int64,1} over 9 outcomes
[1, 1] 5
[1, 2] 2
[1, 3] 7
[2, 1] 2
[2, 2] 8
[2, 3] 6
[3, 1] 7
[3, 2] 6
[3, 3] 6
julia> eachindex(c)
ERROR: MethodError: eachindex(::Counts{Int64, 1, Symbol}) is ambiguous.
Candidates:
eachindex(A::AbstractArray, B::AbstractArray...)
@ Base abstractarray.jl:377
eachindex(c::Counts, args...)
@ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/counts.jl:92
eachindex(A::AbstractVector)
@ Base abstractarray.jl:314
eachindex(A::AbstractArray)
@ Base abstractarray.jl:371
Possible fix, define
eachindex(::Counts{T, 1} where T<:Integer)
Stacktrace:
[1] top-level scope
@ REPL[8]:1
from complexitymeasures.jl.
Some hints:
julia> using ComplexityMeasures
julia> using Test; detect_ambiguities(ComplexityMeasures)
9-element Vector{Tuple{Method, Method}}:
(eachindex(d::Probabilities{T, N, S}, args...) where {T, N, S} @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/probabilities.jl:97, eachindex(A::AbstractArray, B::AbstractArray) @ Base abstractarray.jl:373)
(probabilities(x, est::OutcomeSpace) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/deprecations.jl:49, probabilities(est::ValueBinning, x) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/outcome_spaces/value_binning.jl:66)
(eachindex(c::Counts{T, N}, args...) where {T<:Integer, N} @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/counts.jl:92, eachindex(A::AbstractArray, B::AbstractArray) @ Base abstractarray.jl:373)
(information(est::DifferentialInfoEstimator, args...) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/information_functions.jl:267, information(est::InformationMeasureEstimator, probest::ProbabilitiesEstimator, args...) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/information_measures.jl:91)
((var"#ctor-self#"::Type{Outcome{T}} where T<:Integer)(num) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/outcome.jl:14, (::Type{T})(x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:266)
(probabilities(o::OutcomeSpace, x) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/probabilities.jl:261, probabilities(x, est::OutcomeSpace) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/deprecations.jl:49)
(eachindex(c::Counts{T, N}, args...) where {T<:Integer, N} @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/counts.jl:92, eachindex(A::AbstractArray, B::AbstractArray...) @ Base abstractarray.jl:377)
(eachindex(d::Probabilities{T, N, S}, args...) where {T, N, S} @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/probabilities.jl:97, eachindex(A::AbstractArray, B::AbstractArray...) @ Base abstractarray.jl:377)
((var"#ctor-self#"::Type{Outcome{T}} where T<:Integer)(num) @ ComplexityMeasures ~/Documents/Repos/ComplexityMeasures.jl/src/core/outcome.jl:14, (::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} @ Base char.jl:50)
from complexitymeasures.jl.
The problem was that the generic @eval Base.$(f)(d::Probabilities{T, N, S}, args...) where {T, N, S} = $(f)(d.p, args...)
with the extra args leads to a conflict with eachindex(A::AbstractArray, B::AbstractArray...)
in base. The same is the case for Counts
.
By excluding :eachindex
from the list of symbols to be eval-ed and manually defining Base.eachindex(p::Probabilities) = eachindex(p.p)
, the issue is solved:
julia> c = counts(Dispersion(), rand(50))
Counts{Int64,1} over 9 outcomes
[1, 1] 9
[1, 2] 3
[1, 3] 7
[2, 1] 3
[2, 2] 2
[2, 3] 3
[3, 1] 7
[3, 2] 3
[3, 3] 12
julia> eachindex(c)
Base.OneTo(9)
julia> p = probabilities(Dispersion(), rand(50))
Probabilities{Float64,1} over 9 outcomes
[1, 1] 0.10204081632653061
[1, 2] 0.14285714285714285
[1, 3] 0.08163265306122448
[2, 1] 0.10204081632653061
[2, 2] 0.02040816326530612
[2, 3] 0.10204081632653061
[3, 1] 0.12244897959183673
[3, 2] 0.061224489795918366
[3, 3] 0.2653061224489796
julia> eachindex(p)
Base.OneTo(9)
from complexitymeasures.jl.
Related Issues (20)
- Feature: "increment entropy" HOT 1
- Feature: "attention entropy"
- `missing_probabilities` HOT 1
- `counts_and_outcomes` for `BubbleSortSwaps` should also accept state space sets
- Syntax with type parameter `{m}` in `OrdinalPatterns` is not harmonious with the rest of the library HOT 10
- Encoding using `Dispersion` is slower than necessary due to manual integration for normal cdf
- Encoding complex-valued data HOT 2
- [Q] How to calculate MI between two vectors? HOT 3
- Latest stable documentation has an error in the `StatisticalComplexity` docstring HOT 1
- "Amplitude entropy"
- Good-Turing probabilities estimator HOT 2
- `AddConstant` estimator lacks reference
- Latest tagged release not appearing in neither stable nor dev docs HOT 1
- Our new fluctuation complexity generalization is incorrect. HOT 8
- `TsallisExtropy` doctoring missing some keyword arguments
- Fix deprecated syntax HOT 2
- Variant of `codify` that also returns the outcomes. HOT 2
- Rank-based outcome space HOT 4
- Generalize transfer operator HOT 14
- Optimize transfer operator estimation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from complexitymeasures.jl.