y#

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

Create a skrub variable and mark it as being y.

This is just a convenient shortcut for:

skrub.var("y", value).skb.mark_as_y()

Marking a variable as y tells skrub that this is the column or table of targets 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.X

Create a skrub variable and mark it as being y.

skrub.var

Create a skrub variable.

skrub.Expr.skb.mark_as_y

Mark this expression as being the y table.

Examples

>>> import skrub
>>> col = skrub.toy_orders().delayed
>>> y = skrub.y(col)
>>> y
<Var 'y'>
Result:
―――――――
0    False
1    False
2     True
3    False
Name: delayed, dtype: bool
>>> y.skb.name
'y'
>>> y.skb.is_y
True