metaclean3.outliers

Module Contents

Classes

OutlierDetector

Super class for IsoForestDetector class.

IsoForestDetector

Wrapper for outlier detection model, sklearn.ensemble.IsolationForest.

Functions

drop_outliers(data, outlier_func[, drop_and])

Applies outlier removal function to given data.

metaclean3.outliers.drop_outliers(data: pandas.DataFrame, outlier_func: collections.abc.Callable, drop_and: bool = True)

Applies outlier removal function to given data.

Args:

data (pd.DataFrame): Data from which outlier are detected. outlier_func (Callable): Outlier detection function. drop_and (bool, optional): If True, sets an object as not an outlier if

all (AND) and its feature values were not flagged as outliers. Otherwise, it is not an outlier if any (OR) or its feature values were not flagged as outliers.

Returns:
np.ndarray: A boolean 1D array the same size as the number of rows in

data labelling non-outliers as True.

class metaclean3.outliers.OutlierDetector(model, **kwargs)

Super class for IsoForestDetector class.

abstract fit()
abstract predict()
abstract fit_predict()
class metaclean3.outliers.IsoForestDetector(model=IsolationForest, contamination: float = 0.01, n_estimators: int = 500, random_state: int = 123)

Bases: OutlierDetector

Wrapper for outlier detection model, sklearn.ensemble.IsolationForest.

fit(data)
predict(data: numpy.ndarray, score: bool = True)
fit_predict(data: numpy.ndarray, score: bool = True)