Giter Club home page Giter Club logo

mknn_homology's Introduction

MKNN Homology

A small Python library which implements an outlier detector based on persistent homology.

Usage

You can import the module as

import mknn

This will give you access to the main class, Filtration. If you have already parsed your data into an array of shape (N,d), where N is the number of points and d the dimension of the ambient space, then you can construct a Filtration instance like so

filt = mknn.Filtration(data = data)

Example

You can find an example case here. This file contains 42 points in two dimensions. The dataset has two main clusters and two outliers,

Example clusters.

The two outliers are the points labeled 1 and 2.

To run the detector on this set, first you should store the data in a numpy array as follows

import numpy as np
data = np.genfromtxt("example_data.csv")

Then, you build a Filtration instance:

import mknn
filt = mknn.Filtration(data = data)

Next, instruct the Filtration instance to compute its persistent homology

filt.build_complex()
filt.compute_persistent_homology()

Finally, you can see the persistence plot by calling plot_persistence on filt, which takes a string that will be used as the name of the file in which the plot will be stored.

filt.plot_persistence("persistence_example.png")

Example persistence.

mknn_homology's People

Contributors

arnaumas avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.