athena.utils.general module

Summary

Functions:

is_categorical

is_fitted

is_numeric

is_seq

Checks if the elements in a list-like object are increasing by step

make_iterable

type obj

Any

order

Returns the indices of the ordered elements in x.

Reference

is_numeric(*args, **kwargs)[source]
is_categorical(*args, **kwargs)[source]
make_iterable(obj)[source]
Parameters

obj (Any) – Any object that you want to make iterable

Returns

Return type

Packed object, possible to iterate overs

is_seq(x, step=1)[source]

Checks if the elements in a list-like object are increasing by step

Parameters
  • x (list-like) –

  • step

Returns

Return type

True if elements increase by step, else false and the index at which the condition is violated.

order(x, transform=None, decreasing=False)[source]

Returns the indices of the ordered elements in x.

Parameters
  • x (list_like) – A list_like object

  • transform (function) – a function applied to the elements of x to compute a value based on which the array x should be sorted

  • decreasing (bool) – indicating if the sorting should be in decreasing order

Returns

Return type

The indices of the sorted array

Examples

a = [1,3,2] order(a) # [0,2,1]

a = np.linspace(0,np.pi,5) order(a, transform = lambda x: np.cos(x)) # [4,3,2,1,0]

a = np.linspace(0,np.pi,5) order(a, transform = lambda x: np.cos(x)**2) # [2,3,1,0,4]

is_fitted(estimator)[source]