Giter Site home page Giter Site logo

fastmapy's Introduction

FastMapy

Python implementation of FastMap1 MDS technique for embedding objects into vector spaces and dimensionality reduction of existing vector spaces. The general idea is that the objects are embedding into a vector space based on a defined distance metric over the objects. The resulting vector space attempts to maintain this relative distance between the objects relative to the defined distance metric.

This package has common distance metrics already defined and ready to use over appropriate objects, such as Jaccard distance over character shingled n-gram strings or Levenshtein edit distance for embedding string objects. Euclidean distance and taxi cab distance are also available for vector objects. Dictionary objects also work assuming a sparse vector style dictionary of {index: count} where index can be an actual vector index or a token and it's occurrence count.

Multiprocessing is leveraged for model building and object transformation, but is set to serially use a single core by default.

Example

from fastmap.distances import Jaccard
import fastmap

fm_model = fastmap.FastMap(dim=8, distance=Jaccard, dist_args={'shingle_size':4})

embedding = fm_model.fit_transform(string_data)

The above example defines a FastMap model that utilizes Jaccard distance. The target vector space is 8-dimensional and strings are shingled into 4-grams before the distance is computed. A collection of strings are then used to fit the model and the same strings are transformed into 8-dimensional Numpy arrays.

#References 1 Proceedings of the 1995 ACM SIGMOD international conference on Management of data - SIGMOD โ€™95. (1995). doi:10.1145/223784 โ†ฉ

fastmapy's People

Contributors

shawn-davis avatar

Watchers

 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.