outlier_repeat¶
- outlier_repeat(data: ~numpy.ndarray, sd: float, rounds: int = inf, axis: int = 0, deviation: callable = <function std>, center: callable = <function mean>) tuple[tuple[int, int]][source][source]¶
Remove outliers from data and repeat until no outliers are left.
This function removes outliers from data and repeats until no outliers are left. Outliers are defined as any data point that is more than sd standard deviations from the mean. The function returns a tuple of tuples containing the index of the outlier and the round in which it was removed.
- Parameters:
data (
np.ndarray) – Data to remove outliers from.sd (
float) – Number of standard deviations from the mean to consider an outlier.rounds (
int) – Number of times to repeat outlier removal. If None, the function will repeat until no outliers are left.axis (
int) – Axis of data to remove outliers from.deviation (callable)
center (callable)
- Returns:
Tuple of tuples containing the index of the outlier and the round in which it was removed.
- Return type:
tuple[tuple[int,int]]
Examples
>>> import numpy as np >>> data = np.array([[1, 1, 1, 1, 1], [0, 60, 0, 10, 0]]).T >>> tuple(outlier_repeat(data, 1)) ((1, 1), (3, 2)) >>> tuple(outlier_repeat(data, 1, rounds=1)) ((1, 1),) >>> tuple(outlier_repeat(data, 1, rounds=0)) ()