You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now, covariates X, treatment assignments w and observey outcomes y can be provided as numpy datastructures (np.ndarray) or as pandas datastructures (pd.Series and pd.DataFrame) respectively.
A PR to allow for X to be scipy.sparse.csr_matrix is in the making: PR #86
It might be beneficial to allow for polars datastructures, too.
One question that might arise is how we deal with a potential additional dependency. Do we want to wrap every polars-dependent piece of code in a try-block that tries to import? Do we want to make polars a run dependency of metalearners?
If you'd like to use metalearners with polars please let us know. :)
The text was updated successfully, but these errors were encountered:
One question that might arise is how we deal with a potential additional dependency. Do we want to wrap every polars-dependent piece of code in a try-block that tries to import? Do we want to make polars a run dependency of metalearners?
In this comment, Marco Gorelli suggests the following approach to avoid introducing a run-time dependency:
if (pl:=sys.modules.get('polars', None) isnotNoneandisinstance(data, pl.DataFrame):
# Polars-related logic
...
Hey there! Sick project. I would suggest you look into narwhals by @MarcoGorelli and @FBruzzesi others for support for any dataframe backend.
narwhals is a very thin library that handles compatibility with a bunch of other dataframe backends (polars, dask, modin...). it's currently used, among others, by Altair, scikit-lego, and it's being integrated into Plotly.
Marco and Francesco are super nice and can provide a lot of support for this.
As of now, covariates
X
, treatment assignmentsw
and observey outcomesy
can be provided asnumpy
datastructures (np.ndarray
) or aspandas
datastructures (pd.Series
andpd.DataFrame
) respectively.A PR to allow for
X
to bescipy.sparse.csr_matrix
is in the making: PR #86It might be beneficial to allow for
polars
datastructures, too.One question that might arise is how we deal with a potential additional dependency. Do we want to wrap every polars-dependent piece of code in a try-block that tries to import? Do we want to make
polars
a run dependency ofmetalearners
?If you'd like to use
metalearners
withpolars
please let us know. :)The text was updated successfully, but these errors were encountered: