Skip to main content

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


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.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

mt3-0.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file mt3-0.2.0.tar.gz.

File metadata

  • Download URL: mt3-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10

File hashes

Hashes for mt3-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b9d93b833d87e2692cb07e76ab1cc93c56b06d566d361ea41c2f40ac898655ad
MD5 04e94d576ecc3f3c91f6842eeb1675c9
BLAKE2b-256 628a0d6de384145d288d7b17be469ab2d612f023fcd271419336b0e9afbbd65b

See more details on using hashes here.

File details

Details for the file mt3-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mt3-0.2.0-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

Hashes for mt3-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf9894c26140ae8c3bb65fd7c25cba5b2ef68d4f4c6a71f23564bda83add3a0
MD5 963797a1d97fc8bd708eb90ef2c756ed
BLAKE2b-256 02887129bb2b18caa24267971b018f1c3be95cb2d3fd84cfa336cc6c6ad842cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page