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

Request to add Polars (dataframe) backend #351

Open
humphreylee opened this issue May 9, 2023 · 3 comments
Open

Request to add Polars (dataframe) backend #351

humphreylee opened this issue May 9, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@humphreylee
Copy link

Would it be possible to add Polars (dataframe) as backend? Thanks.

@itrumper
Copy link
Contributor

itrumper commented May 9, 2023

Can you explain a bit more about what you mean by "backend"? Do you want to use the dataframes as your Param, Gradient, or Output types in the problem?

If so, you can always implement the trait bounds from the solver on those types, and argmin should happily optimize with them. I recently just learned about this capability (see discussion).

@stefan-k
Copy link
Member

Would it be possible to add Polars (dataframe) as backend?

I haven't used Polars yet, therefore I can't really comment on this. This requires someone with Polars expertise.

If so, you can always implement the trait bounds from the solver on those types, and argmin should happily optimize with them.

That's true; however in that case you would be implementing a foreign trait on a foreign type which is prohibited by the orphan rule. To circumvent this limitation the newtype pattern is necessary. Note that this isn't really prohibiting, just a bit of an annoyance.
Therefore ideally third-party backends should be supported in argmin-math, because then the traits aren't foreign.

@stefan-k stefan-k added enhancement New feature or request help wanted Extra attention is needed labels May 10, 2023
@humphreylee
Copy link
Author

Can you explain a bit more about what you mean by "backend"? Do you want to use the dataframes as your Param, Gradient, or Output types in the problem?

If so, you can always implement the trait bounds from the solver on those types, and argmin should happily optimize with them. I recently just learned about this capability (see discussion).

Probably "backend" is not the correct term. What I meant is can Polars support be added similar to ndarray or nalgebra? My data (CSV) is a mix of strings and numbers, which is happily handled in dataframe (in R or Julia). The data is not pure numbers. Instead of doing multiple conversion (CSV -> polars -> ndarray / nalgebra), would love to see argmin{} handle directly Polars data format. Just a suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants