Skip to main content

clip_nb

Clip a number to be within the given bounds. Parameters: Returns:

get_log_nb

Compute the logarithm of a number, avoiding NaN and infinity. If the input is NaN or infinity, returns a small negative value. Parameters: Returns:

get_log_diff_nb

Compute log difference for 2-dimensional arrays. Parameters: Returns:

get_diff_nb

Compute difference for 2-dimensional arrays. Parameters: Returns:

zscore_nb

Compute the z-score of the last element relative to the entire array. Parameters: Returns:

get_rolling_zscore_nb

Compute rolling z-scores over a given window. Parameters: Returns:

get_rolling_mean_1d_nb

Compute the rolling mean of a one-dimensional array. Uses rolling_mean_acc_nb at each iteration. Numba equivalent to pd.Series(arr).rolling(window, min_periods=minp).mean(). Parameters: Returns:

get_rolling_sum_1d_nb

Compute rolling sum for a one-dimensional array. Uses rolling_sum_acc_nb to update the accumulation state for each iteration, emulating the behavior of pd.Series(arr).rolling(window, min_periods=minp).sum(). Parameters: Returns:

get_rolling_ols_zscore_nb

Compute rolling ordinary least squares (OLS) regression zscore for 2-dimensional arrays. This function applies a 1-dimensional OLS regression on each column. Parameters: Returns:

get_rolling_ols_pred_nb

Compute OLS regression errors for 2-dimensional arrays. This function applies error computation column-wise. Parameters: Returns:

get_rolling_ols_residual_nb

Compute OLS regression errors for 2-dimensional arrays. This function applies error computation column-wise. Parameters: Returns:

get_rolling_deviation_nb

Compute the rolling deviation of an array. Parameters: Returns:

get_rolling_std_nb

Compute rolling standard deviation over a given window. Parameters: Returns:

get_ecdf

Create an empirical cumulative distribution function (ECDF). Parameters: Returns:

get_weighted_average_nb

Compute the weighted average along the specified axis. Parameters: Raises: Returns:

get_cumulative_index_nb

Calculate cumulative index. This function computes the cumulative sum of a prediction array while subtracting the given center value, then iteratively accumulating the results. Parameters: Returns:

get_reset_index_nb

Calculate reset index. This function computes the reset index, which resets the accumulated sum if it exceeds the specified upper or lower bounds. Parameters: Returns:

get_clip_index_nb

Calculate clip index. This function clips the accumulated sum of predictions within the specified lower and upper bounds. NaN values are replaced with previous valid values during processing. At the end, NaN values are reapplied to the output where they appeared in the input. The optional mask parameter is a 1D array selecting valid values across all columns. If mask value is True, values are replaced with previous valid values. Otherwise, accumulated sum of predictions. If None, no masking is applied. if bound_reversion is set to True, it compute the cumulative sum of negative (positive) values toward the center, ignoring mask, uppon reaching the upper or lower bound respectively. This technique increases the speed of reversion toward neutrality. Defaults to False. Parameters: Returns: Raises:

get_scaled_zscore

Map a z-score (which ranges from -\infty to ++\infty) to a value in the interval [1,1][-1,1] using the error function. The key idea is based on the fact that the cumulative distribution function (CDF) of the standard normal distribution is: ϕ(z)=12(1+erf(z2))\phi(z) = \frac{1}{2} \left( 1 + \operatorname{erf} \left( \frac{z}{\sqrt{2}} \right) \right) To scale this to [1,1][-1,1], you can transform it as: transformed value=2Φ(z)1=erf(z2)\text{transformed value} = 2\Phi(z) - 1 = \operatorname{erf}\left(\frac{z}{\sqrt{2}}\right) where erf is the error function. This expression, erf(z/2)\operatorname{erf}\left(z/\sqrt{2}\right), naturally yields values between 1-1 (for zz \to -\infty) and 11 (for z+z \to +\infty), with 00 corresponding to z=0z=0. Parameters: Returns:

get_ellipse

Create ellipse. Parameters: Returns: