turicreate.SArray.is_topk

SArray.is_topk(topk=10, reverse=False)

Create an SArray indicating which elements are in the top k.

Entries are ‘1’ if the corresponding element in the current SArray is a part of the top k elements, and ‘0’ if that corresponding element is not. Order is descending by default.

Parameters:
topk : int

The number of elements to determine if ‘top’

reverse : bool

If True, return the topk elements in ascending order

Returns:
out : SArray (of type int)

Notes

This is used internally by SFrame’s topk function.