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.2.1.tar.gz
.
File metadata
- Download URL: pymof-0.2.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d388e530b964673d78233a7a630c8c53c7c543f42bf0aebc457d48a0991294db |
|
MD5 | 4538042b281c834464ce637435094f98 |
|
BLAKE2b-256 | 32111ff193cedeb9a1c8f5bf82b079c7a71c8b3e9a671d579d68d072cb97c968 |
File details
Details for the file pymof-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: pymof-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d53a4eb72c02af26c6184159c72d133b0dedbd48d5aedfc7e9e90127b01ab637 |
|
MD5 | c759f8c6ff6df43e41a845f0175156d8 |
|
BLAKE2b-256 | 6f2acb0f837c2339ac6b715ff45325d770c3b6f6aeb048641eedf423b629be23 |