GithubHelp home page GithubHelp logo

anirband / rescal.py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mnick/rescal.py

0.0 2.0 0.0 152 KB

Python module to compute the RESCAL tensor factorization

License: GNU General Public License v3.0

Python 100.00%

rescal.py's Introduction

RESCAL

This module provides standalone routines to compute various forms of the RESCAL tensor factorization.

RESCAL factors a (usually sparse) three-way tensor X such that each frontal slice X_k is factored into

X_k = A * R_k * A.T

The frontal slices of X are quadratic, possibly asymmetric N x N matrices. Usually, these matrices correspond to the sparse adjacency matrices of the relational graph for a particular relation in a multi-relational data set.

A copy of this standalone module of RESCAL is also included in the scikit-tensor libray.

Dependencies

The required dependencies to build the software are Numpy >= 1.3, SciPy >= 0.7.

Usage

Example script to decompose kinships data using RESCAL-ALS:

import logging
from scipy.io.matlab import loadmat
from scipy.sparse import lil_matrix
from rescal import rescal_als

# Set logging to INFO to see RESCAL information
logging.basicConfig(level=logging.INFO)

# Load Matlab data and convert it to dense tensor format
T = loadmat('data/alyawarra.mat')['Rs']
X = [lil_matrix(T[:, :, k]) for k in range(T.shape[2])]

# Decompose tensor using RESCAL-ALS
A, R, fit, itr, exectimes = rescal_als(X, 100, init='nvecs', lambda_A=10, lambda_R=10)

For more examples on the usage of RESCAL, please see the examples directory in the source tree.

References

If you use rescal.py in your research, please cite

Maximilian Nickel, Volker Tresp, Hans-Peter-Kriegel,
"A Three-Way Model for Collective Learning on Multi-Relational Data",
Proceedings of the 28th International Conference on Machine Learning (ICML'11), 
809--816, ACM, Bellevue, WA, USA, 2011

or

Maximilian Nickel, Volker Tresp, Hans-Peter-Kriegel,
"Factorizing YAGO: Scalable Machine Learning for Linked Data"
Proceedings of the 21st International Conference on World Wide Web (WWW'12),
271--280, ACM, Lyon, France, 2012

Install

This package uses distutils, which is the default way of installing python modules. To install in your home directory, use::

python setup.py install --user

To install for all users on Unix/Linux

python setup.py build
sudo python setup.py install

To install in development mode

python setup.py develop

Authors

Maximilian Nickel

License

rescal.py is licensed under the GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt

rescal.py's People

Watchers

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