ROCF (Relative Outlier Cluster Factor)

MATLAB implementation of the Relative Outlier Cluster Factor (ROCF) algorithm
22 download
Aggiornato 20 ago 2021

matlab-rocf

View ROCF (Relative Outlier Cluster Factor) on File Exchange

This repo contains a MATLAB implementation of the ROCF (Relative Outlier Cluster Factor) clustering algorithm by Jinlong Huang et al..

ROCF (Relative Outlier Cluster Factor) detects isolated outliers and outlier clusters based upon a mutual k-nearest neighbor graph and the idea that outlier clusters are much smaller in size than normal clusters. It also detects normal clusters in addition to outlier clusters, but it's main intent is outlier detection. For more details, see the original paper.

Dependencies

  • My knn-graphs MATLAB library
  • Statistics and Machine Learning Toolbox

To run the tests contained in the Jupyter notebook, you will need to install the Jupyter matlab kernel.

To use the NN Descent algorithm to construct the mutual KNN graph used by ROCF, you need pynndescent and MATLAB's Python language interface. I recommend using Conda to set up an environment, as MATLAB is picky about which Python versions it supports.

Installation

Install with mpm:

mpm install knn-graphs
mpm install rocf

Manual installation

  • Download knn-graphs from the MATLAB File Exchange
  • Download matlab-rocf from the MATLAB File Exchange or from the latest GitHub release
  • Add both packages to your MATLAB path

Usage

Rocf is a class with a single public method, cluster. The results of the clustering operation are stored in read-only public properties. Rocf is an iceberg class, which, depending on who you ask, is either bad or good...

Creating an Rocf object:

% Create an Rocf object using a 5-nearest-neighbor graph.
% nNeighborsIndex is how many neighbors used to create the knn index, and must be >= nNeighbors + 1
% because the index includes self-edges (each point is it's own nearest neighbor).
nNeighors = 5;
nNeighborsIndex = 6;
rocf = Rocf(data, nNeighbors, nNeighborsIndex);

% Use the NN Descent algorithm to create the knn index; this is much faster than an exhaustive search
rocf = Rocf(data, nNeighbors, nNeighborsIndex, 'Method', 'nndescent');

% Explicitly use an exhaustive search, which is the default
rocf = Rocf(data, nNeighbors, nNeighborsIndex, 'Method', 'knnsearch');

% Use a precomputed knn index
knnidx = knnindex(data, nNeighborsIndex);
rocf = Rocf(data, nNeighbors, knnidx);

Clustering:

rocf.cluster();
% Or
cluster(rocf);

% Inspect clusters, outliers, and labels
rocf.Clusters
rocf.Outliers
rocf.Labels

For more details, see the help text: help Rocf. ROCF tests.ipynb also contains many tests, which can be used as usage examples.

Contributing

All contributions are welcome! Just submit a pull request or open an issue.

Cita come

Trevor Vannoy (2024). ROCF (Relative Outlier Cluster Factor) (https://github.com/tvannoy/matlab-rocf/releases/tag/v1.0.1), GitHub. Recuperato .

Compatibilità della release di MATLAB
Creato con R2020a
Compatibile con R2020a e release successive
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.1

See release notes for this release on GitHub: https://github.com/tvannoy/matlab-rocf/releases/tag/v1.0.1

1.0

Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.
Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.