Files | Functions

Files

file  quantiles.hpp
 

Functions

std::unique_ptr< columncudf::quantile (column_view const &input, std::vector< double > const &q, interpolation interp=interpolation::LINEAR, column_view const &ordered_indices={}, bool exact=true, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Computes quantiles with interpolation. More...
 
std::unique_ptr< tablecudf::quantiles (table_view const &input, std::vector< double > const &q, interpolation interp=interpolation::NEAREST, cudf::sorted is_input_sorted=sorted::NO, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Returns the rows of the input corresponding to the requested quantiles. More...
 

Detailed Description

Function Documentation

◆ quantile()

std::unique_ptr<column> cudf::quantile ( column_view const &  input,
std::vector< double > const &  q,
interpolation  interp = interpolation::LINEAR,
column_view const &  ordered_indices = {},
bool  exact = true,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Computes quantiles with interpolation.

Computes the specified quantiles by interpolating values between which they lie, using the interpolation strategy specified in interp.

Parameters
[in]inputColumn from which to compute quantile values.
[in]qSpecified quantiles in range [0, 1].
[in]interpStrategy used to select between values adjacent to a specified quantile.
[in]ordered_indicesColumn containing the sorted order of input. If the column is empty, all input values are used in existing order. Indices must be in range [0, input.size()), but are not required to be unique. Values not indexed by this column will be ignored.
[in]exactIf true, returns doubles. If false, returns same type as input.
Returns
Column of specified quantiles, with nulls for indeterminable values.

◆ quantiles()

std::unique_ptr<table> cudf::quantiles ( table_view const &  input,
std::vector< double > const &  q,
interpolation  interp = interpolation::NEAREST,
cudf::sorted  is_input_sorted = sorted::NO,
std::vector< order > const &  column_order = {},
std::vector< null_order > const &  null_precedence = {},
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Returns the rows of the input corresponding to the requested quantiles.

Quantiles are cut points that divide the range of a dataset into continuous intervals. e.g: quartiles are the three cut points that divide a dataset into four equal-sized groups. See https://en.wikipedia.org/wiki/Quantile

The indices used to gather rows are computed by interpolating between the index on either side of the desired quantile. Since some columns may be non-arithmetic, interpolation between rows is limited to non-arithmetic strategies.

Non-arithmetic interpolation strategies include HIGHER, LOWER, and NEAREST.

quantiles <= 0 correspond to row 0. (first) quantiles >= 1 correspond to row input.size() - 1. (last)

Parameters
inputTable used to compute quantile rows.
qDesired quantiles in range [0, 1].
interpStrategy used to select between the two rows on either side of the desired quantile.
sortedIndicates if the input has been pre-sorted.
column_orderThe desired sort order for each column.
null_precedenceThe desired order of null compared to other elements.
Exceptions
cudf::logic_errorif interp is an arithmetic interpolation strategy
cudf::logic_errorif input is empty