Skip to main content

Outlier detection using supervised methods in a supervised context

Project description

Pseudo-supervised outlier detection

A highly performant alternative to purely unsupervised approaches.

PSOD uses supervised methods to identify outliers in unsupervised contexts. It offers higher accuracy for outliers with top scores than other models while keeping comparable performance on the whole dataset.

The usage is simple.

1.) Install the package:

pip install psod

2.) Import the package:

from psod.outlier_detection.psod import PSOD

3.) Instantiate the class:

iso_class = PSOD()

The class has multiple arguments that can be passed. If older labels exist these could be used for hyperparameter tuning.

4.) Recommended: Normalize the data

from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
scaler.fit(treatment_data[cols])
scaled = scaler.transform(treatment_data[cols])
scaled = pd.DataFrame(scaled, columns=cols)

5.) Fit and predict:

full_res = iso_class.fit_predict(scaled, return_class=True)

6.) Predict on new data:

full_res = iso_class.predict(scaled, return_class=True)

Classes and outlier scores can always be accessed from the class instance via:

iso_class.scores  # getting the outlier scores
iso_class.outlier_classes  # get the classes

The repo contains example notebooks. Please note that example notebooks do not always contain the newest version. The file psod.py is always the most updated one. See the full article

Meta

Creator: Thomas Meißner – LinkedIn

PSOD GitHub repository

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

psod-0.0.3.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

psod-0.0.3-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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