A simple module for outlier detection thanks to Modified Thompson Tau Test
Project description
Installation
mt3
requires Python 3.8+
To install the package run :
pip install mt3
If you are planing to use it with numpy
and/or pandas
, add optionnal dependencies :
pip install mt3[pandas, numpy] # or pip install mt3[numpy] for numpy only
mt3
will then be capable to deal with numpy.ndarray
and pd.Series
.
By default mt3
is provided with a table of Student T critical values. Available confidence levels are [0.9, 0.95, 0.975, 0.99, 0.995, 0.999]
. To be able to use any confidence level, add scipy
optionnal dependency :
pip install mt3[scipy]
Usage
mt3
main function is modified_thompson_tau_test
:
from mt3 import modified_thompson_tau_test
sample = [-4, 3, -5, -2, 0, 1, 1000]
# You can use it with a simple list :
modified_thompson_tau_test(sample, 0.99)
# [False, False, False, False, False, False, True]
# But you can also use it with a numpy.ndarray or a pandas.Series
import numpy as np
import pandas as pd
modified_thompson_tau_test(np.array(sample), 0.99)
# [False False False False False False True] (numpy array)
modified_thompson_tau_test(pd.Series(sample), 0.99)
# [False False False False False False True] (numpy array)
# If you have nan values in your array or Series, you can choose to treat
# them as outliers
sample_with_nan = np.array([-4, np.nan, 3, -5, -2, 0, 1, 1000])
modified_thompson_tau_test(sample_with_nan, 0.99, nan_is_outlier=True)
# [False True False False False False False True] (numpy array)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mt3-0.2.1.tar.gz
(6.9 kB
view details)
Built Distribution
mt3-0.2.1-py3-none-any.whl
(7.2 kB
view details)
File details
Details for the file mt3-0.2.1.tar.gz
.
File metadata
- Download URL: mt3-0.2.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae38a496e415630b08c0688b03cabc9ea8a13ce31a77c880bc8a36d4b670e71 |
|
MD5 | 48e0da37ad07eab329c66b00822d1fe8 |
|
BLAKE2b-256 | 0dc4e22ce89cfcb227e26cd9f1a2984d867867c9f73118f386a536084873439f |
File details
Details for the file mt3-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: mt3-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71cedb414d29f175ecd48d9032feb9e568e686d16a5736b90e08e52fc3e1fbc1 |
|
MD5 | 6eb79a9cff16faf56151407bc1deb32d |
|
BLAKE2b-256 | 579be80b1bc18b2b11cdef601c5d40082a643e08d96c2ff1a60395ca80b4137d |