Git Product home page Git Product logo

rdc's Introduction

RDC: Randomized Dependence Coefficient

Algorithm by: David Lopez-Paz, Philipp Hennig, and Bernhard Schoelkopf

Code by: Gary Doran

Installation Instructions

To install, run:

$ [sudo] python setup.py install

Algorithm Description

The RDC is a measure of nonlinear dependence between two (possibly multidimensional) variables. A full description of the algorithm is given in the 2013 paper by David Lopez-Paz, Philipp Hennig, and Bernhard Schoelkopf.

Usage

Given two NumPy arrays, x and y, the measure can be invoked as follows:

>>> from rdc import rdc
>>> print rdc(x, y)

If x and y are univariate, then they should be 1-D NumPy arrays; otherwise, then should be n-by-k arrays, where k is the number of dimensions and n is the number of examples. The two variables must have the same number of examples, but can have different numbers of features.

There are additional keyword parameters for rdc that correspond to parameters described in the paper. One new parameter is n, which is the number of times the RDC is computed with different random seeds to reduce variance in the estimation of the statistic. The median value across these n runs is returned.

rdc's People

Contributors

garydoranjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rdc's Issues

Issues computing RDC

To whom it may concern,

I have Python 3.6.5 on a windows machine. Downloaded the rdc.py file, and imported into my Python script. To test the correlation measure, 2d synthetic data sets were generated (http://minepy.sourceforge.net/docs/1.0.0/python.html).

When I run my script, these are the encountered problems:
A) slice indices must be integers or None or have an index method

This is caused at line with command: Cxx = C[:k, :k]. I noticed that the k value becomes a real number at the second iteration of the while loop.

To fix this issue, i added this comman line: k= np.round(k).astype(np.int)

B) LinAlgError: Singular matrix

This is caused at line with command: eigs = np.linalg.eigvals(np.dot(np.dot(np.linalg.inv(Cxx), Cxy), np.dot(np.linalg.inv(Cyy), Cyx)))

for this issue, I couldn't find a way to fix it.

I attached a copy of my Python script and input data.

Many thanks,
Ivan
Python_RDC_2D_Synthetic_Data.zip

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.