Least squares anomaly detection.
- Compatible with scikit-learn package modules
- Probabilistic outlier detection model
- Robust classifier when given multiple inlier classes
- Easy to install and get started
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.
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([,,,,,]))
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] >>> lsanomaly.predict_proba() array([[ 0.5760205, 0.4239795]])
J.A. Quinn, M. Sugiyama. A least-squares approach to anomaly detection in static and sequential data. Pattern Recognition Letters 40:36-40, 2014.
To check out the complete release notes see the changelog.
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
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size lsanomaly-0.1.3.tar.gz (7.1 kB)||File type Source||Python version None||Upload date||Hashes View|