X#

skrub.X(value=NULL)[source]#

Create a skrub variable and mark it as being X.

This is just a convenient shortcut for:

skrub.var("X", value).skb.mark_as_X()

Marking a variable as X tells skrub that this is the design matrix that must be split into training and testing sets for cross-validation. Please refer to the examples gallery for more information.

Parameters:
valueobject

The value passed to skrub.var(), which is used for previews of the pipeline’s outputs, cross-validation etc. as described in the documentation for skrub.var() and the examples gallery.

Returns:
A skrub variable

See also

skrub.y

Create a skrub variable and mark it as being y.

skrub.var

Create a skrub variable.

skrub.Expr.skb.mark_as_X

Mark this expression as being the X table.

Examples

>>> import skrub
>>> df = skrub.toy_orders().orders_
>>> X = skrub.X(df)
>>> X
<Var 'X'>
Result:
―――――――
   ID product  quantity        date
0   1     pen         2  2020-04-03
1   2     cup         3  2020-04-04
2   3     cup         5  2020-04-04
3   4   spoon         1  2020-04-05
>>> X.skb.name
'X'
>>> X.skb.is_X
True