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

SINGLE and BATCH #27

Open
cortner opened this issue May 7, 2023 · 8 comments
Open

SINGLE and BATCH #27

cortner opened this issue May 7, 2023 · 8 comments

Comments

@cortner
Copy link
Member

cortner commented May 7, 2023

is there a solution to this ambiguity?

julia> x = @SVector rand(3)
3-element SVector{3, Float64} with indices SOneTo(3):
 0.589586907694296
 0.7260573271521483
 0.22833616024528036

julia> x isa Polynomials4ML.SINGLE
true

julia> x isa Polynomials4ML.BATCH
true

It is maybe not so important because of this:

julia> wii(::Polynomials4ML.SINGLE) = "single"
wii (generic function with 1 method)

julia> wii(::Polynomials4ML.BATCH) = "batch"
wii (generic function with 2 methods)

julia> wii(x)
"single"
@cortner
Copy link
Member Author

cortner commented Jun 5, 2023

In light of some recent changes to the abstract type hierarchy (CC @CheukHinHoJerry ) maybe this can now be re-designed? Basically what happens is that different classes of bases now put different meanings to the term SINGLE and BATCH. This will surely help here.

@cortner
Copy link
Member Author

cortner commented Jun 5, 2023

maybe some meta-programming ... ?

@cortner
Copy link
Member Author

cortner commented Jul 14, 2023

@CheukHinHoJerry -- I was thinking about the following:

A matrix A can be a single input or it can be a batch of inputs. Therefore we need to be able to label what it is. I propose to introduce a wrapper type Batch that identifies when an array is a batch as opposed to a single input. Then the batched evaluation can dispatch on that. E.g.

rr = # Vectors of input radial distances 
Rn = # radial basis
evaluate(Rn, Batch(rr)) 
# output will be a `Batch{Matrix}` rather than a `Matrix`

(or something along those lines) What do you think of this?

How do the most common ML frameworks deal with that?

@CheukHinHoJerry
Copy link
Collaborator

Sorry for missing that in early Jun. What you mentioned sounds right. I will mull this over a little while and get back to you tonight.

@CheukHinHoJerry
Copy link
Collaborator

CheukHinHoJerry commented Jul 14, 2023

Should we also consider this together with what we want to do in #18 (comment)?

Can we at the same time drop all codes that with only single input, reshape PtrArray for free and label the output array as what you have mentioned? This makes a lot of sense to me.

@cortner
Copy link
Member Author

cortner commented Jul 14, 2023

you are right, this is closely related.

@cortner
Copy link
Member Author

cortner commented Jul 27, 2023

Maybe we can add this issue to our discussion with @tjjarvinen

@CheukHinHoJerry
Copy link
Collaborator

Before we rewrite anything maybe we should first discuss this?

CC @tjjarvinen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants