sksurv.functions.StepFunction#

class sksurv.functions.StepFunction(x, y, *, a=1.0, b=0.0, domain=(0, None))[source]#

A callable step function.

The function is defined by a set of points \((x_i, y_i)\) and is evaluated as:

\[f(z) = a \cdot y_i + b \quad \text{if} \quad x_i \leq z < x_{i + 1}\]
Parameters:
  • x (ndarray, shape = (n_points,)) – The values on the x-axis, must be in ascending order.

  • y (ndarray, shape = (n_points,)) – The corresponding values on the y-axis.

  • a (float, optional, default: 1.0) – A constant factor to scale y by.

  • b (float, optional, default: 0.0) – A constant offset term.

  • domain (tuple, optional, default: (0, None)) – A tuple (lower, upper) that defines the domain of the step function. If lower or upper is None, the first or last value of x is used as the limit, respectively.

__init__(x, y, *, a=1.0, b=0.0, domain=(0, None))[source]#

Methods

__init__(x, y, *[, a, b, domain])

Attributes

domain

The domain of the function.

property domain#

The domain of the function.

The domain is the range of values that the function accepts.

Returns:

  • lower_limit (float) – Lower limit of the omain.

  • upper_limit (float) – Upper limit of the domain.