Mass ratio variance-based outlier factor (MOF)
Project description
pymof
Installation
You can install pymof
using pip
pip install pymof # normal install
pip install --upgrade pymof # or update if needed
Required Dependencies :
- Python 3.9 or higher
- numpy>=1.23
- numba>=0.56.0
- scipy>=1.8.0
- scikit-learn>=1.2.0
- matplotlib>=3.5
Mass ratio variance-based outlier factor (MOF)
the outlier score of each data point is called MOF
. It measures the global deviation of density given sample with respect to other data points.
it is global in the outlier score depend on how isolated. data point is with respect to all data points in the data set.
the variance of mass ratio can identify data points that have a substantially. lower density compared to other data points.
These are considered outliers.
MOF()
Initial a model of
MOF
Parameters :
Return :
self : object
object of MOF model
MOF.fit(Data)
Fit data to
MOF
model Note The data size should not exceed 10000 points because MOF uses high memory.
Parameters :
Data : numpy array of shape (n_points, d_dimensions)
The input samples.
Return :
self : object
fitted estimator
MOF.visualize()
Visualize data points with
MOF
's scores Note cannot visualize data points with dimension more than 3
Parameters :
Return :
decision_scores_ : numpy array of shape (n_samples)
decision score for each point
MOF attributes
Attributes | Type | Details |
---|---|---|
MOF.Data | numpy array of shape (n_points, d_dimensions) | input data for model |
MOF.MassRatio | numpy array of shape (n_samples, n_points) | MassRatio for each a pair of points |
MOF.decision_scores_ | numpy array of shape (n_samples) | decision score for each point |
Examples
# This example demonstrates the usage of MOF
from pymof import MOF
import numpy as np
X = [[-2.30258509, 7.01040212, 5.80242044],
[ 0.09531018, 7.13894636, 5.91106761],
[ 0.09531018, 7.61928251, 5.80242044],
[ 0.09531018, 7.29580291, 6.01640103],
[-2.30258509, 12.43197678, 5.79331844],
[ 1.13140211, 9.53156118, 7.22336862],
[-2.30258509, 7.09431783, 5.79939564],
[ 0.09531018, 7.50444662, 5.82037962],
[ 0.09531018, 7.8184705, 5.82334171],
[ 0.09531018, 7.25212482, 5.91106761]]
X = np.array(X)
c = MOF()
c.fit(X)
scores = c.decision_scores_
print(scores)
c.visualize()
Output
[0.34541068 0.11101711 0.07193073 0.07520904 1.51480377 0.94558894 0.27585581 0.06242823 0.2204504 0.02247725]
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
Built Distribution
File details
Details for the file pymof-0.1.tar.gz
.
File metadata
- Download URL: pymof-0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3568f7be8a2ba00e38be03fc8014887a7431671ad767a2f27e8e6a258ccce6d0 |
|
MD5 | e599bc86294e9cd77e5d25c9189014e9 |
|
BLAKE2b-256 | 670db3dd9cedd515a7dd2813e462a3c1b9af5e3677e17a6a067160cdec0479c6 |
File details
Details for the file pymof-0.1-py3-none-any.whl
.
File metadata
- Download URL: pymof-0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c9d19e4400037f44dbad6c75352b8e5489e892568ee3abf2be88c6c7136d9f |
|
MD5 | c1feb58092b7947c77d19574fca9bb94 |
|
BLAKE2b-256 | 116f5b85cecff9287590a04bea62c6f744c8bc48d886377ab3581fff3290dbea |