xtensor
|
Enumerations | |
enum class | xt::quantile_method { xt::quantile_method::interpolated_inverted_cdf = 4 , xt::quantile_method::hazen , xt::quantile_method::weibull , xt::quantile_method::linear , xt::quantile_method::median_unbiased , xt::quantile_method::normal_unbiased } |
Quantile interpolation method. More... | |
Functions | |
template<class E > | |
auto | xt::sort (const xexpression< E > &e, std::ptrdiff_t axis=-1) |
Sort xexpression (optionally along axis) The sort is performed using the std::sort functions. | |
template<class E > | |
auto | xt::argsort (const xexpression< E > &e, std::ptrdiff_t axis=-1, sorting_method method=sorting_method::quick) |
Argsort xexpression (optionally along axis) Performs an indirect sort along the given axis. | |
template<class E , class C , class R = detail::flatten_sort_result_type_t<E>, class = std::enable_if_t<!xtl::is_integral<C>::value, int>> | |
R | xt::partition (const xexpression< E > &e, C kth_container, placeholders::xtuph) |
Partially sort xexpression. | |
template<class E , class C , class R = typename detail::linear_argsort_result_type<typename detail::sort_eval_type<E>::type>::type, class = std::enable_if_t<!xtl::is_integral<C>::value, int>> | |
R | xt::argpartition (const xexpression< E > &e, C kth_container, placeholders::xtuph) |
Partially sort arguments. | |
template<class T = double, class E , class P > | |
auto | xt::quantile (E &&e, const P &probas, std::ptrdiff_t axis, T alpha, T beta) |
Compute quantiles over the given axis. | |
template<class T = double, class E , class P > | |
auto | xt::quantile (E &&e, const P &probas, T alpha, T beta) |
Compute quantiles of the whole expression. | |
template<class T = double, class E , class P > | |
auto | xt::quantile (E &&e, const P &probas, std::ptrdiff_t axis, quantile_method method=quantile_method::linear) |
Compute quantiles over the given axis. | |
template<class T = double, class E , class P > | |
auto | xt::quantile (E &&e, const P &probas, quantile_method method=quantile_method::linear) |
Compute quantiles of the whole expression. | |
template<class E > | |
auto | xt::median (E &&e, std::ptrdiff_t axis) |
Find the median along the specified axis. | |
template<layout_type L = ::xt::layout_type::row_major, class E > | |
auto | xt::argmax (const xexpression< E > &e, std::ptrdiff_t axis) |
Find position of maximal value in xexpression By default, the returned index is into the flattened array. | |
template<class E > | |
auto | xt::unique (const xexpression< E > &e) |
Find unique elements of a xexpression. | |
template<class E1 , class E2 > | |
auto | xt::setdiff1d (const xexpression< E1 > &ar1, const xexpression< E2 > &ar2) |
Find the set difference of two xexpressions. | |
Because sorting functions need to access the tensor data repeatedly, they evaluate their input and may allocate temporaries.
|
strong |
Quantile interpolation method.
Predefined methods for interpolating quantiles, as defined in (Hyndman and Fan, 1996).
|
inline |
Find position of maximal value in xexpression By default, the returned index is into the flattened array.
If axis
is specified, the indices are along the specified axis.
e | input xexpression |
axis | select axis (optional) |
|
inline |
Partially sort arguments.
Argpartition shuffles the indices to a xexpression in a way so that the index for the kth element in the returned xexpression is in the place it would appear in a sorted array and all elements smaller than this entry are placed (unsorted) before.
The optional third parameter can either be an axis or xnone()
in which case the xexpression will be flattened.
This function uses std::nth_element
internally.
e | input xexpression |
kth_container | a container of indices that should contain the correctly sorted value |
axis | either integer (default = -1) to sort along last axis or xnone() to flatten before sorting |
|
inline |
Argsort xexpression (optionally along axis) Performs an indirect sort along the given axis.
Returns an xarray of indices of the same shape as e that index data along the given axis in sorted order.
e | xexpression to argsort |
axis | axis along which argsort is performed |
method | sorting algorithm to use |
Find the median along the specified axis.
Given a vector V of length N, the median of V is the middle value of a sorted copy of V, V_sorted - i e., V_sorted[(N-1)/2], when N is odd, and the average of the two middle values of V_sorted when N is even.
axis | axis along which the medians are computed. If not set, computes the median along a flattened version of the input. |
e | input xexpression |
|
inline |
Partially sort xexpression.
Partition shuffles the xexpression in a way so that the kth element in the returned xexpression is in the place it would appear in a sorted array and all elements smaller than this entry are placed (unsorted) before.
The optional third parameter can either be an axis or xnone()
in which case the xexpression will be flattened.
This function uses std::nth_element
internally.
e | input xexpression |
kth_container | a container of indices that should contain the correctly sorted value |
axis | either integer (default = -1) to sort along last axis or xnone() to flatten before sorting |
|
inline |
Compute quantiles of the whole expression.
The quantiles are computed over the whole expression, as if flatten in a one-dimensional expression. The function takes the name of a predefined method to compute to interpolate between values.
|
inline |
Compute quantiles over the given axis.
The function takes the name of a predefined method to compute to interpolate between values.
Compute quantiles over the given axis.
In a sorted array represneting a distribution of numbers, the quantile of a probability p
is the the cut value q
such that a fraction p
of the distribution is lesser or equal to q
. When the cutpoint falls between two elemnts of the sample distribution, a interpolation is computed using the alpha
and beta
coefficients, as descripted in (Hyndman and Fan, 1996).
The algorithm partially sorts entries in a copy along the axis
axis.
e | Expression containing the distribution over which the quantiles are computed. |
probas | An list of probability associated with each desired quantiles. All elements must be in the range [0, 1] . |
axis | The dimension in which to compute the quantiles, i.e the axis representing the distribution. |
alpha | Interpolation parameter. Must be in the range [0, 1]] . |
beta | Interpolation parameter. Must be in the range [0, 1]] . |
T | The type in which the quantile are computed. |
e
. The first axis correspond to the quantiles. The other axes are the axes that remain after the reduction of e
. Compute quantiles of the whole expression.
The quantiles are computed over the whole expression, as if flatten in a one-dimensional expression.
|
inline |
|
inline |