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

ObsDimArray #43

Open
oxinabox opened this issue Jun 20, 2019 · 6 comments
Open

ObsDimArray #43

oxinabox opened this issue Jun 20, 2019 · 6 comments
Labels
enhancement New feature or request RequiresThinking For issues / feature requests that need detailed and careful consideration

Comments

@oxinabox
Copy link
Member

One thing, I was thinking is that we could have a special alias for just specifying the observation dimentions.
Which could be useful for dispatch.

it would be:

obs_name_tuple(n) = ntuple(i->i==n ? :obs, :_)
const ObsDimArray{D, T, N} = NamedDims {obs_name_tuple(D), T, N}

const RowObsArray{T, N} = ObsDimArray{1, T, N}
const ColObsArray{T, N} = ObsDimArray{2, T, N}
const LastDimObsArray{T, N} = ObsDimArray{N, T, N}

So the following would be equivelent:

RowObsArray{Float32, 3} == NamedDimsArray{(:obs, :_, :_), Float32}

I'm not sure yet if the dispatch fully works, for mixtures of ObsDImArrays and NamedDimArrays where just one of the names is :observations, but that can potentially be changed.
(It would likely mean moving to Named being stored not as (:a,:b) type params but as Tuple{:a, :b}. Which would allow for Tuple{:obs, :<Any}. This wouild also allow for other bitvalues and types to be used as names. e,g #40 nut that is getting off-topic)

@iamed2
Copy link
Member

iamed2 commented Jun 20, 2019

Is the "observation dimension" the dimension such that a slice with all other dimensions as : and that dimension as a single value produces one observation? Sorry if I didn't phrase that well.

@oxinabox
Copy link
Member Author

Correct.

@Tokazama
Copy link
Contributor

This seems very similar to a lot of what https://github.com/JuliaImages/ImageAxes.jl does. Might be a helpful starting point for this.

@willtebbutt
Copy link
Member

This would be cool to have. FWIW, I would definitely add a special case to Stheno to handle this type.

@oxinabox
Copy link
Member Author

oxinabox commented Sep 6, 2019

The change from the dim-names type-params being a Tuple like (:a, :b) to being a Type{Tuple} like Tuple{:a. :b}
is ugly but it facilitates dispatching on non-exact names.
Which is pretty useful.

we could also have a helper function
to construct constraitns like like
NamedTuple{<:Union{Tuple{:obs, Any}, Tuple{Any, :obs}}}
which would dispatch on having a obs dimenion in either dim1 or dim2

@nickrobinson251
Copy link
Contributor

@nickrobinson251 nickrobinson251 added enhancement New feature or request RequiresThinking For issues / feature requests that need detailed and careful consideration labels Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request RequiresThinking For issues / feature requests that need detailed and careful consideration
Projects
None yet
Development

No branches or pull requests

5 participants