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

Flexible pipelines with multiple tables, previews and easy hyperparameter tuning #1233

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

jeromedockes
Copy link
Member

@jeromedockes jeromedockes commented Feb 5, 2025

very much WIP, I'm opening the PR so the first example renders and we can discuss it.
The added examples are the last ones in the gallery

  • "Building complex tabular pipelines"
  • "Tuning hyperparameters"

then, TODO:

  • add some tests
  • some refactoring & cleanup
  • finish examples
  • reference documentation
  • ... so pretty much everything 😅

@GaelVaroquaux
Copy link
Member

Very much WIP, but already a cool example to look at https://output.circle-artifacts.com/output/job/34c076e7-2a4d-4616-946d-bfb5c27d2167/artifacts/0/doc/auto_examples/10_expressions.html#sphx-glr-auto-examples-10-expressions-py
🤩

Comment on lines 221 to 232
# To help us visualize intermediate results and make development more
# interactive, we can provide a placeholder value for each variable. Skrub will
# use it to compute previews of the results. This helps inspect what the
# results will look like, catch errors early, and provide better tab-completion
# on attribute and item names.
#
# Instead of writing ``products = skrub.var("products")`` as before, let us
# start over, this time passing a placeholder value to make our expression a
# little bit more helpful:

# %%
products = skrub.var("products", placeholder=products_df)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this part is explained well. This section is called "Eager previews", but until now it's not clear that expressions are evaluated lazily. I think it should be made more explicit that with_total.skb.eval({"products": products_df}) does not print anything because it hasn't been executed yet.

You could say something like "if we try to print with_total at this stage, we do not get useful information. In order to obtain a preview of the current step, we need to add a placeholder value, which Skrub uses to compute a preview of the results".

Two more things:

  • A preview of the results means that it contains the results up until this point, or in this particular operation, or a subset of the overall results (a sampling for example)?
  • Is the placeholder variable used for something else? If it's only used for previews, maybe it would be better to be more explicit about it. Someone might get the idea that "you could put any placeholder df here to activate the preview". I'm not sure what the best variable name would be here, but I fear placeholder may lead to misunderstandings 🤔

Copy link
Member Author

@jeromedockes jeromedockes Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reading through this @rcap107 . I'll try to improve this part based on your comment.

with_total.skb.eval({"products": products_df}) does not print anything

do you mean with_total does not print anything? because eval runs the computation, so the command above does produce a result

A preview of the results means that it contains the results up until this point, or in this particular operation, or a subset of the overall results (a sampling for example)?

the result of evaluating the expression with the bindings provided by the placeholder values

>>> a = skrub.var('a', 1)
>>> e = a + a + a
>>> e.skb.preview
3

but I fear placeholder may lead to misunderstandings

yes I agree it's not a good name. these values are used

  • for the previews
  • to provide data for cross-validation, fitting the estimator, or the hyperparam search.

In all cases they can be replaced by passing a dictionary so

pred.skb.cross_validate() # uses the "placeholder" data
pred.skb.cross_validate({'customers': cust, 'orders': orders, 'labels': labels}) # uses the provided values instead

maybe we should call it something more generic like value or data? or default_value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcap107 WDYT of default_value instead of placeholder? it conveys better that this value can be replaced by something else, whereas a placeholder must be replaced?

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

Successfully merging this pull request may close these issues.

3 participants