These first notebook aims to evaluate the Additive Noise Models over pairs of observated variables. The variables are continuous and the directions are known, so we can evaluate the accuracy of the ANM's and try to reproduce the benchmarks
In [1]:
import readline
import rpy2.robjects
import code.additive_noise as an
import numpy as np
import numpy.random as rn
In [2]:
# First we load the metadata and the right directions. X->Y will be represented as 1, while Y->X is represented as -1
metadata = np.loadtxt('./pairmeta.txt')
directions = metadata[:,3]-metadata[:,2]
In [3]:
#We iterate through all the pairs (we exlude only three that give an error with pyGPs) and predict the directionality
# of the causal relationship. For pairs with more than 500 datapoints we will only consider the first 500 for faster
# computation
accuracy = list()
for i in range(105):
pair = str(i+1)
if len(pair)==1:
pair = '000'+ pair
if len(pair)==2:
pair = '00'+ pair
if len(pair)==3:
pair = '0'+ pair
if pair != '0047' and pair != '0060' and pair != '0061':
data = np.loadtxt('./data/pair'+pair+'.txt')
if data.shape[0]>500:
data = data[0:500]
if data.shape[1]==2:
X = data[:,0]
Y = data[:,1]
dire = an.ANM_algorithm_pairwise(X,Y, hsic='py')
if dire == directions[i]:
accuracy.append(1)
else:
accuracy.append(0)
else:
continue
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 39
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 2
Number of line searches 40
Number of line searches 40
Number of line searches 18
Number of line searches 40
Number of line searches 40
Number of line searches 22
Number of line searches 2
Number of line searches 40
Number of line searches 40
Number of line searches 2
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 4.7221095448e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.7221095448e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.7221095448e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.7221095448e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.7221095448e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.8809875461e+23 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.8809875461e+24 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.8809875461e+25 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.8809875461e+26 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.8809875461e+27 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.6446205230e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.6446205230e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.6446205230e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.6446205230e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.6446205230e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5056671255e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5056671255e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5056671255e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5056671255e+19 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5056671255e+20 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.7790545091e+27 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.7790545091e+28 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.7790545091e+29 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.7790545091e+30 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.7790545091e+31 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.5046521550e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.5046521550e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.5046521550e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.5046521550e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.5046521550e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8689509949e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8689509949e+19 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8689509949e+20 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8689509949e+21 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8689509949e+22 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.0884875146e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.0884875146e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.0884875146e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.0884875146e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.0884875146e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.5399538472e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.5399538472e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.5399538472e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.5399538472e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.5399538472e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4550595569e+22 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4550595569e+23 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4550595569e+24 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4550595569e+25 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4550595569e+26 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.0193057485e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.0193057485e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.0193057485e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.0193057485e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.0193057485e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0802114362e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0802114362e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0802114362e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0802114362e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0802114362e+19 to diagnol of kernel matrix for numerical stability
Number of line searches 10
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 19
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 3.2732176257e+31 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2732176257e+32 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2732176257e+33 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2732176257e+34 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2732176257e+35 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.5399596242e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.5399596242e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.5399596242e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.5399596242e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.5399596242e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.9233119381e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.9233119381e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.9233119381e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.9233119381e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.9233119381e+10 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 37
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 1.0031224326e+21 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0031224326e+22 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0031224326e+23 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0031224326e+24 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0031224326e+25 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9896828118e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9896828118e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9896828118e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9896828118e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9896828118e+12 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 5.1958950592e+82 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.1958950592e+83 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.1958950592e+84 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.1958950592e+85 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.1958950592e+86 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.7492151102e+41 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.7492151102e+42 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.7492151102e+43 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.7492151102e+44 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.7492151102e+45 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2094797866e+20 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2094797866e+21 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2094797866e+22 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2094797866e+23 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.2094797866e+24 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3747709834e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3747709834e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3747709834e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3747709834e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3747709834e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.9976317216e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.9976317216e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.9976317216e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.9976317216e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.9976317216e+08 to diagnol of kernel matrix for numerical stability
Number of line searches 15
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 18
Number of line searches 15
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 1.4084719918e+22 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4084719918e+23 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4084719918e+24 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4084719918e+25 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4084719918e+26 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 20
Number of line searches 40
Warning: adding jitter of 1.4081191917e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4081191917e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4081191917e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4081191917e+19 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4081191917e+20 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.6502193295e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.6502193295e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.6502193295e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.6502193295e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.6502193295e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.6426755057e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.6426755057e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.6426755057e+19 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.6426755057e+20 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.6426755057e+21 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3003279748e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3003279748e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3003279748e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3003279748e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.3003279748e+10 to diagnol of kernel matrix for numerical stability
Number of line searches 16
Number of line searches 15
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 15
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 17
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 2
Number of line searches 2
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 2
Number of line searches 40
Number of line searches 2
Number of line searches 2
Number of line searches 2
Number of line searches 2
Number of line searches 40
Number of line searches 40
Number of line searches 2
Number of line searches 26
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 1.0886903261e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0886903261e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0886903261e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0886903261e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0886903261e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8458961677e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8458961677e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8458961677e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8458961677e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.8458961677e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.8094406916e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.8094406916e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.8094406916e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.8094406916e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.8094406916e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.1764133136e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.1764133136e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.1764133136e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.1764133136e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.1764133136e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.3156521200e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.3156521200e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.3156521200e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.3156521200e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.3156521200e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0164141833e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0164141833e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0164141833e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0164141833e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0164141833e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0549171053e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0549171053e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0549171053e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0549171053e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.0549171053e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.4011769826e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.4011769826e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.4011769826e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.4011769826e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 8.4011769826e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0801623481e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0801623481e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0801623481e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0801623481e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0801623481e+08 to diagnol of kernel matrix for numerical stability
Number of line searches 6
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 1.5854090081e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5854090081e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5854090081e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5854090081e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.5854090081e+17 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 18
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 22
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 39
Warning: adding jitter of 7.1505547606e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.1505547606e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.1505547606e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.1505547606e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.1505547606e+11 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Warning: adding jitter of 4.9580163903e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.9580163903e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.9580163903e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.9580163903e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 4.9580163903e+17 to diagnol of kernel matrix for numerical stability
Number of line searches 12
Number of line searches 40
Warning: adding jitter of 1.9717356344e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9717356344e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9717356344e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9717356344e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.9717356344e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.1693230011e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.1693230011e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.1693230011e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.1693230011e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.1693230011e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.9960739497e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.9960739497e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.9960739497e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.9960739497e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 5.9960739497e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.7961384746e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.7961384746e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.7961384746e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.7961384746e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.7961384746e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1088681435e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1088681435e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1088681435e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1088681435e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1088681435e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.6610269806e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.6610269806e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.6610269806e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.6610269806e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 6.6610269806e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.1865978122e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.1865978122e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.1865978122e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.1865978122e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.1865978122e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.8113982361e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.8113982361e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.8113982361e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.8113982361e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.8113982361e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.7089305101e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.7089305101e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.7089305101e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.7089305101e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 7.7089305101e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4721709696e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4721709696e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4721709696e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4721709696e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.4721709696e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.8851199094e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.8851199094e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.8851199094e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.8851199094e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 3.8851199094e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0622316715e+04 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0622316715e+05 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0622316715e+06 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0622316715e+07 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.0622316715e+08 to diagnol of kernel matrix for numerical stability
Number of line searches 7
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 9.4528890679e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.4528890679e+12 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.4528890679e+13 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.4528890679e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 9.4528890679e+15 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Number of line searches 40
Warning: adding jitter of 2.1208427653e+14 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1208427653e+15 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1208427653e+16 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1208427653e+17 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.1208427653e+18 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.6614155846e+26 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.6614155846e+27 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.6614155846e+28 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.6614155846e+29 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 1.6614155846e+30 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.3962027823e+08 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.3962027823e+09 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.3962027823e+10 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.3962027823e+11 to diagnol of kernel matrix for numerical stability
Warning: adding jitter of 2.3962027823e+12 to diagnol of kernel matrix for numerical stability
Number of line searches 40
Number of line searches 18
Number of line searches 40
Number of line searches 40
In [6]:
len(accuracy)
Out[6]:
93
In [8]:
np.array(accuracy).sum()/float(len(accuracy))
Out[8]:
0.66666666666666663
The resulting accuracy is 63.44% vs. the 64% reported by Peters et al.2016
In [2]:
import pandas as pd
def parse_dataframe(df):
parse_cell = lambda cell: np.fromstring(cell, dtype=np.float, sep=" ")
df = df.applymap(parse_cell)
return df
data = parse_dataframe(pd.read_csv('./data2/CEdata_train_pairs.csv', index_col="SampleID"))
data = data.reset_index()
metadata = pd.read_csv('./data2/CEdata_train_target.csv', delimiter=',')
metadata.columns = ['id', '', 'target']
In [8]:
accuracy = list()
for i , t in enumerate(metadata[0:150].target):
print i
print data.ix[i].SampleID
if t==1 or t==2:
X = data.ix[i].A
Y = data.ix[i].B
if X.shape[0]>1000:
X = X[0:1000]
Y = Y[0:1000]
try:
dire = an.ANM_algorithm_pairwise(X,Y, hsic='py')
if dire == -1:
dire = 2
if dire == t:
accuracy.append(1)
else:
accuracy.append(0)
except:
continue
else:
continue
0
train1
Number of line searches 2
Number of line searches 2
1
train2
Number of line searches 2
Number of line searches 2
2
train3
Number of line searches 2
Number of line searches 2
3
train4
4
train5
Number of line searches 2
Number of line searches 2
5
train6
Number of line searches 2
Number of line searches 2
6
train7
Number of line searches 2
Number of line searches 2
7
train8
8
train9
9
train10
10
train11
11
train12
Number of line searches 2
Number of line searches 2
12
train13
13
train14
14
train15
15
train16
Number of line searches 2
Number of line searches 2
16
train17
Number of line searches 2
Number of line searches 2
17
train18
18
train19
19
train20
Number of line searches 2
Number of line searches 2
20
train21
21
train22
Number of line searches 2
Number of line searches 2
22
train23
Number of line searches 2
Number of line searches 2
23
train24
Number of line searches 2
Number of line searches 2
24
train25
Number of line searches 2
Number of line searches 2
25
train26
Number of line searches 2
Number of line searches 2
26
train27
27
train28
Number of line searches 2
Number of line searches 2
28
train29
29
train30
30
train31
31
train32
32
train33
Number of line searches 2
Number of line searches 2
33
train34
Number of line searches 2
Number of line searches 2
34
train35
35
train36
36
train37
Number of line searches 2
Number of line searches 2
37
train38
Number of line searches 2
Number of line searches 2
38
train39
39
train40
40
train41
Number of line searches 2
Number of line searches 2
41
train42
42
train43
Number of line searches 2
Number of line searches 2
43
train44
Number of line searches 2
Number of line searches 2
44
train45
Number of line searches 2
Number of line searches 2
45
train46
46
train47
Number of line searches 2
Number of line searches 2
47
train48
48
train49
Number of line searches 2
Number of line searches 2
49
train50
Number of line searches 2
Number of line searches 2
50
train51
Number of line searches 2
Number of line searches 2
51
train52
52
train53
Number of line searches 2
Number of line searches 2
53
train54
Number of line searches 2
Number of line searches 2
54
train55
55
train56
Number of line searches 2
Number of line searches 2
56
train57
57
train58
Number of line searches 2
Number of line searches 2
58
train59
59
train60
Number of line searches 2
Number of line searches 2
60
train61
61
train62
62
train63
63
train64
64
train65
Number of line searches 2
Number of line searches 2
65
train66
Number of line searches 2
Number of line searches 2
66
train67
67
train68
68
train69
Number of line searches 2
Number of line searches 2
69
train70
70
train71
Number of line searches 2
Number of line searches 2
71
train72
Number of line searches 2
Number of line searches 2
72
train73
Number of line searches 2
Number of line searches 2
73
train74
Number of line searches 2
Number of line searches 2
74
train75
75
train76
76
train77
77
train78
78
train79
Number of line searches 2
Number of line searches 2
79
train80
80
train81
Number of line searches 2
Number of line searches 2
81
train82
82
train83
83
train84
84
train85
85
train86
86
train87
Number of line searches 2
Number of line searches 2
87
train88
88
train89
Number of line searches 2
Number of line searches 2
89
train90
90
train91
Number of line searches 2
Number of line searches 2
91
train92
92
train93
Number of line searches 40
Number of line searches 2
93
train94
94
train95
95
train96
96
train97
97
train98
Number of line searches 2
Number of line searches 2
98
train99
99
train100
100
train101
101
train102
Number of line searches 2
Number of line searches 2
102
train103
103
train104
104
train105
105
train106
Number of line searches 2
Number of line searches 2
106
train107
107
train108
Number of line searches 2
Number of line searches 2
108
train109
109
train110
Number of line searches 2
Number of line searches 2
110
train111
Number of line searches 2
Number of line searches 2
111
train112
Number of line searches 2
Number of line searches 2
112
train113
Number of line searches 2
Number of line searches 2
113
train114
114
train115
Number of line searches 2
Number of line searches 2
115
train116
Number of line searches 2
Number of line searches 2
116
train117
117
train118
118
train119
Number of line searches 2
Number of line searches 2
119
train120
Number of line searches 2
Number of line searches 2
120
train121
Number of line searches 2
Number of line searches 2
121
train122
122
train123
Number of line searches 2
Number of line searches 2
123
train124
124
train125
Number of line searches 2
Number of line searches 2
125
train126
Number of line searches 2
Number of line searches 2
126
train127
Number of line searches 2
Number of line searches 2
127
train128
Number of line searches 2
Number of line searches 2
128
train129
129
train130
130
train131
131
train132
Number of line searches 2
Number of line searches 2
132
train133
Number of line searches 2
Number of line searches 2
133
train134
134
train135
135
train136
136
train137
Number of line searches 2
Number of line searches 2
137
train138
Number of line searches 2
Number of line searches 2
138
train139
139
train140
Number of line searches 2
Number of line searches 2
140
train141
Number of line searches 2
Number of line searches 2
141
train142
142
train143
143
train144
Number of line searches 2
Number of line searches 2
144
train145
Number of line searches 2
Number of line searches 2
145
train146
146
train147
147
train148
148
train149
149
train150
Number of line searches 2
Number of line searches 2
In [9]:
np.array(accuracy).sum()/float(len(accuracy))
Out[9]:
0.58904109589041098
In [3]:
accuracy
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-f67ae9ba6c58> in <module>()
----> 1 accuracy
NameError: name 'accuracy' is not defined
In [ ]:
Content source: mvp291/dsga1005
Similar notebooks: