Code Monkey home page Code Monkey logo

pyodm's Introduction

pyODM

Contact: Fares Meghdouri - [email protected]

Observers-based Data Modeling - paper: "Modeling Data with Observers" (pending)

Installation

pyodm can be installed using pip by running pip install git+https://github.com/CN-TU/pyodm

Note that in order for ODM to work with an M-Tree core, the implementation (package) in M-Trees needs to be installed. The repository is private and will be available soon.

Usage

Please note that many parameters can be adjusted in order to build a representative model refer to the paper for more information.

Create a model

import pyodm

# create a new model with default parameters
model = pyodm.ODM(random_state=1)

Construct a coreset

import numpy
#import pandas

# read the data
X = np.load('my_dataset.npy')

#or
#X = pandas.read_csv('my_dataset.csv').values

# model the data
model.fit(X)

# access the array of observers
print(model.observers)

# access the array of radius
print(model.radius)

# access the array of populations
print(model.population)

Outlierness scores

In order to get the outlierness score of a set of points (based on an ODM model), run the foolowing after fitting a model

# read the data
X_test = np.load('my_test_dataset.npy')

# get the outlierness scores
outlierness_scores = model.outlierness(X_test)

Anomaly detection

One can convert the outlierness score into a binary label (outlier/inlier) using the following

# read the data
X_test = np.load('my_test_dataset.npy')

# convert the outlierness scores into binary labels using a contamination threshold
predictions = model.predict(X_test) 

Points labeling

to get the label of the closest observer to a set of points use

# read the data
X_test = np.load('my_test_dataset.npy')

# return the predicted label of each test point (refering to `model.observers`)
predicted_labels = model.labels(X_test)

Get parameters

# return a dictionnary of the current parameters
model.get_params()

This will return a dictionnary of parameters used to build the model.\

Visual Examples

Example1: Three datasets in which datapoints are represented in gray and the ODM model in red each with a different configuration. Three datasets in which data-points are represented in gray and the ODM model in red each with a different configuration.

Example2: Convergence path of an observer. Convergence path of an observer.

Example3: Two clusters datasets with two observers. Two clusters datasets with two observers.

Example4: Five clusters datasets with six observers. Five clusters datasets with six observers.

pyodm's People

Contributors

fm94 avatar

Watchers

James Cloos 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.