Skip to main content

Table of Contents

Features

  • Compatible with scikit-learn package modules

  • Probabilistic outlier detection model

  • Robust classifier when given multiple inlier classes

  • Easy to install and get started

Installation

The best way to install lsanomaly is to:

pip install lsanomaly

Because lsanomaly requires scikit-learn it also requires numpy and scipy inherintly. Make sure you have successfully installed these packages if you’re having trouble getting lsanomaly to install.

Usage

For those familiar with scikit-learn the interface will be familiar, in fact lsanomaly was built to be compatible with sklearn modules where applicable. Here is basic usage of lsanomaly to get started quick as possible.

Configuring the Model

The LSAnomaly provides reasonable default parameters when given an empty init or it can be passed values for rho and sigma. The value rho controls sensitivity to outliers and sigma determines the ‘smoothness’ of the boundary. These values can be tuned to improve your results using lsanomaly.

from lsanomaly import LSAnomaly

# At train time lsanomaly calculates parameters rho and sigma
lsanomaly = LSAnomaly()
# or alternatively
lsanomaly = LSAnomaly(sigma=3, rho=0.1)

Training the Model

After the model is configured the training data can be fit.

import numpy as np
lsanomaly.fit(np.array([[1],[2],[3],[1],[2],[3]]))

Making Predictions

Now that the data is fit, we will probably want to try and predict on some data not in the training set.

>>> lsanomaly.predict([0])
[0.0]
>>> lsanomaly.predict_proba([0])
array([[ 0.5760205,  0.4239795]])

Reference

J.A. Quinn, M. Sugiyama. A least-squares approach to anomaly detection in static and sequential data. Pattern Recognition Letters 40:36-40, 2014.

[pdf]

Documentation

Coming soon…

History

To check out the complete release notes see the changelog.

License

The MIT License (MIT)

Copyright (c) 2016 John Quinn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH

Metadata

Release files for lsanomaly 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lsanomaly 0.1.3
File Size Uploaded Provenance Actions
lsanomaly-0.1.3.tar.gz 7.1 kB Without provenance Details for lsanomaly-0.1.3.tar.gz

Release files / lsanomaly-0.1.3.tar.gz

Download URL lsanomaly-0.1.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ca1b06715a1c839545914ec7148d680d501ce1b3a92b2db91052787946654716
BLAKE2b-256 checksum
How to use checksums
24869dbd44ac822657fda0d93fc6d6d1722ebb9e15139864b5e95580affd1fd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for lsanomaly 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page