Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant of codify that also returns the outcomes. #420

Open
kahaaga opened this issue Jul 27, 2024 · 2 comments
Open

Variant of codify that also returns the outcomes. #420

kahaaga opened this issue Jul 27, 2024 · 2 comments
Labels
encodings Related to the Encodings API enhancement New feature or request that is non-breaking outcomes/probabilities

Comments

@kahaaga
Copy link
Member

kahaaga commented Jul 27, 2024

Currently, codify applies some discretisation to an input vector of observation which encodes data points in a sliding-window-manner (e.g. over embedding points constructed from the input data). Each data point is encoded into an integer. It would be nice to have a function that also returns the outcomes corresponding to the integer.

This would allow much nicer Counts/Probabilities upstream:

using Associations
x, y = StateSpaceSet(rand(1000, 2)), StateSpaceSet(rand(1000, 3))

 # min/max of the `rand` call is 0 and 1
precise = true # precise bin edges
r = range(0, 1; length = 3)
binning = FixedRectangularBinning(r, dimension(x), precise)
encoding_x = RectangularBinEncoding(binning, x)
encoding_y = CombinationEncoding(RelativeMeanEncoding(0.0, 1, n = 2), OrdinalPatternEncoding(3))
discretization = CodifyPoints(encoding_x, encoding_y)

# now estimate probabilities
probabilities(discretization, x, y)

julia> probabilities(discretization, x, y)
 4×12 Probabilities{Float64,2}
       6      8      12      11      9      1      10      2      4      7      3      5
 1     0.024  0.022   0.03    0.019  0.03   0.029   0.018  0.02   0.023  0.025  0.023  0.022
 4     0.023  0.027   0.017   0.019  0.022  0.022   0.016  0.019  0.029  0.014  0.017  0.014
 3     0.021  0.019   0.015   0.018  0.021  0.028   0.021  0.018  0.016  0.021  0.027  0.019
 2     0.013  0.033   0.016   0.024  0.019  0.02    0.017  0.022  0.018  0.02   0.01   0.02

It would be nice to know what these integers in the marginals correspond to.

This isn't by any means necessary, but it would be a nice addition.

@kahaaga kahaaga added enhancement New feature or request that is non-breaking encodings Related to the Encodings API outcomes/probabilities labels Jul 27, 2024
@Datseris
Copy link
Member

the only way this would be non breaking is with a wrapper function such as codify_into_outcomes that calls codify and then does the extra step.

@kahaaga
Copy link
Member Author

kahaaga commented Jul 27, 2024

the only way this would be non breaking is with a wrapper function such as codify_into_outcomes that calls codify and then does the extra step.

Yep, an additional function is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
encodings Related to the Encodings API enhancement New feature or request that is non-breaking outcomes/probabilities
Projects
None yet
Development

No branches or pull requests

2 participants