Code Monkey home page Code Monkey logo

rdfsim's Introduction

RDFSim
======

This Python library helps generating a vector space from very large hierarchies encoded in RDF. An obvious example application is to generate a vector space from a SKOS hierarchy or an RDFS subclass hierarchy.

Getting started
---------------

Running the tests:

    $ nosetests

Installing:
 
    $ python setup.py install

Example use
-----------

    $ wget http://downloads.dbpedia.org/3.7/en/skos_categories_en.nt.bz2
    $ bunzip2 skos_categories_en.nt.bz2
    $ python
    >>> from rdfsim.space import Space
    >>> space = Space('skos_categories_en.nt')
    >>> space.similarity_uri(category1, category2)

Constructing a vector space for the entire DBpedia SKOS category
hierarchy (3M triples) takes a couple of minutes on a commodity laptop, 
and has a memory footprint of about 500M.

Alternatively, a subset of it is available in the examples/ directory.

How it works
------------

For each topic t in the hierarchy, we consider the set of its parents
parents(t, k) at a level k. We construct a vector for each t in a space
where each dimension corresponds to a topic d in the hierarchy. The value
of t on dimension d is defined as follows:

    t_d = \sum_{k = 0}^{max_depth} \sum_{d \in parents(t, k)} decay^k

where max_depth and decay are two parameters, which can be used to influence
how much importance we attach to ancestors that are high in the
category hierarchy.

They can be specified as follows:

    >>> Space.max_depth = 8
    >>> Space.decay = 0.9

Licensing terms and authorship
------------------------------

See 'COPYING' and 'AUTHORS' files.

rdfsim's People

Contributors

moustaki 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.