Notes

selection of variable

Principal Variables

iterative search of variables that covariates more with Y response vector. After the first PV is found, the matrix is reduced to find the next one.

KW: supervised methods

Nørgaard, L., Saudland, A., Wagner, J., Nielsen, J. P., Munck, L., & Engelsen, S. B. (2000). Interval Partial Least-Squares Regression ( i PLS): A Comparative Chemometric Study with an Example from Near-Infrared Spectroscopy. Applied Spectroscopy, 54(3), 413–419. http://doi.org/10.1366/0003702001949500

Forward stepwise selection

Apply univariate statistic to all variables and validate prediction on test set for all of them. Variable with lower RMSEP (error on the test/validation set) is chosen. All two-variable models are then build and evaluated, until the inclusion of new variable doesn't affect RMSEP anymore. For the selection of variable care must be taken not to overfit and independant validation test is often required.

KW: supervised methods

Nørgaard, L., Saudland, A., Wagner, J., Nielsen, J. P., Munck, L., & Engelsen, S. B. (2000). Interval Partial Least-Squares Regression ( i PLS): A Comparative Chemometric Study with an Example from Near-Infrared Spectroscopy. Applied Spectroscopy, 54(3), 413–419. http://doi.org/10.1366/0003702001949500

Recursive weighted Regression

the loadings are used to weight the X matrix recursively until convergence. Only the number of variable is chosen arbitrarily.

KW: supervised methods

Rinnan, Å., Andersson, M., Ridder, C., & Engelsen, S. B. (2014). Recursive weighted partial least squares (rPLS): An efficient variable selection method using PLS. Journal of Chemometrics, 28(5), 439–447. http://doi.org/10.1002/cem.2582

Modeling

interval PCA / PLS

the spectra is split into interval (fixed or variable) size and models are build for each of them. Interval with best results are attributed to intervals of the spectra of most interest for the global model.

Remark: how does it behave with very small interval (literature uses interval twice as big as regular interval for PLS). How dows it compare with univariate variable selection?

Nørgaard, L., Saudland, A., Wagner, J., Nielsen, J. P., Munck, L., & Engelsen, S. B. (2000). Interval Partial Least-Squares Regression ( i PLS): A Comparative Chemometric Study with an Example from Near-Infrared Spectroscopy. Applied Spectroscopy, 54(3), 413–419. http://doi.org/10.1366/0003702001949500


In [1]:
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
%matplotlib inline 
R = 5*1.8 #km
A = np.pi*np.power(R,2)
A


Out[1]:
254.46900494077323

PCA

number of components

Determining the number of components in PCA analysis is crucial because it allows to distinguis the informative variance from the noise. It is expected that the former is larger than the latter and therefore the first eignevalues of the covariance matrix (the variances of the first components) are larger than the following ones.

The Tracy-Widom probability density function describes the distribution of the largest eigenvalues for completely random covariance matrices. Therefore it provides a test ot whether the data have structure (informative variables) or not.

Saccenti, E., & Timmerman, M. E. (2016). Approaches to sample size determination for multivariate data: Applications to PCA and PLS-DA of omics data. Journal of Proteome Research, 15(8), 2379–2393. http://doi.org/10.1021/acs.jproteome.5b01029

no funciono


In [2]:
n = 2000
p = 500

S = np.matrix( (np.random.normal(0,1,n*p).reshape(n,p)) )
C = np.cov(np.transpose(S)) 

S = np.subtract(S, np.mean( S, axis=0 ))
#np.round( np.mean( S, axis=0 ) )
C2 = np.divide( np.matmul(np.transpose(S),S), n )
#C = C - np.diag(C)
#C = np.identity(p)
#C[0,0] = 10
#C[1,1] = 8
A = np.linalg.eig(C2)

plt.title('sorted eigenvalues')
#plt.plot(np.arange(C.shape[0]), A[0])
plt.plot(np.arange(C.shape[0]), sorted(A[0],reverse=True))
plt.show()

plt.title('limiting histogram of eigenvalues')
plt.hist(sorted(np.real(A[0])),bins=50)
plt.show()

df = pd.DataFrame(A[0])
df.plot.density(title='limiting density of eigenvalues')


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-019b224d814b> in <module>()
     23 plt.show()
     24 
---> 25 df = pd.DataFrame(A[0])
     26 df.plot.density(title='limiting density of eigenvalues')

NameError: name 'pd' is not defined

In [360]:
np.var(S[:,1])


Out[360]:
0.98327283381558295

In [314]:
np.mean(S[:,1])


Out[314]:
3.552713678800501e-17

In [ ]:


In [ ]:


In [ ]:


In [379]:
n = 5
p = 5
D = []
L = 10000

for i in range(0, L):
    #S = np.matrix( (sp.randn(n,p)) )
    S = np.matrix( (np.random.normal(0,1,n*p).reshape(n,p)) )
    S = np.subtract(S, np.mean( S, axis=0 ))
    C = np.divide( np.matmul(np.transpose(S),S), n )
    A = np.linalg.eig(C)
    D.append(np.max(A[0]))


plt.plot(np.arange(L), sorted(D,reverse=True))
plt.show()



In [380]:
plt.hist(D,bins=100)
plt.show()



In [381]:
df = pd.DataFrame(D)
df.plot(kind='density')


Out[381]:
<matplotlib.axes._subplots.AxesSubplot at 0x121262d68>

In [ ]:


In [ ]:


In [391]:
C = np.identity(p)
C[0,0] = 10
C[1,1] = 8

In [397]:
C


Out[397]:
array([[ 10.,   0.,   0.,   0.,   0.],
       [  0.,   8.,   0.,   0.,   0.],
       [  0.,   0.,   1.,   0.,   0.],
       [  0.,   0.,   0.,   1.,   0.],
       [  0.,   0.,   0.,   0.,   1.]])

In [398]:
np.linalg.eig(C)


Out[398]:
(array([ 10.,   8.,   1.,   1.,   1.]), array([[ 1.,  0.,  0.,  0.,  0.],
        [ 0.,  1.,  0.,  0.,  0.],
        [ 0.,  0.,  1.,  0.,  0.],
        [ 0.,  0.,  0.,  1.,  0.],
        [ 0.,  0.,  0.,  0.,  1.]]))

In [401]:
C = np.arange(0,9).reshape(3,3)
C


Out[401]:
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 8]])

In [403]:
A = np.linalg.eig(C)
A


Out[403]:
(array([  1.33484692e+01,  -1.34846923e+00,  -1.15433316e-15]),
 array([[ 0.16476382,  0.79969966,  0.40824829],
        [ 0.50577448,  0.10420579, -0.81649658],
        [ 0.84678513, -0.59128809,  0.40824829]]))

In [407]:
np.matmul( A[1], np.transpose(A[0]) )


Out[407]:
array([  1.12097436,   6.61079673,  12.1006191 ])

In [390]:
plt.matshow(np.matmul(np.transpose(S),S))
plt.show()
np.matmul(np.transpose(S),S)


Out[390]:
matrix([[  6.05680942,   6.35746886,  -3.65037618,   2.22960854,
           1.06565521],
        [  6.35746886,   8.81753445,  -4.94913105,   3.29954631,
          -0.21422307],
        [ -3.65037618,  -4.94913105,   5.84039731,  -2.4141185 ,
          -0.76359265],
        [  2.22960854,   3.29954631,  -2.4141185 ,   1.86817163,
           2.07191094],
        [  1.06565521,  -0.21422307,  -0.76359265,   2.07191094,
          10.04302941]])

In [385]:
np.percentile(D,50)


Out[385]:
2.230687041939861

In [310]:
plt.hist(sorted(np.real(A[0])),bins=50)
plt.show()



In [249]:
np.power( np.sqrt(n)+np.sqrt(p), 2 )


Out[249]:
40.000000000000007

In [328]:
mu_np = np.power( np.sqrt(n-1) + np.sqrt(p), 2)
sigma_np = np.multiply( np.sqrt(n-1) + np.sqrt(p), np.power(1/np.sqrt(n-1)+1/np.sqrt(p),1/3))

In [329]:
(A[0][0] - mu_np) / sigma_np


Out[329]:
-251.81718334607544

In [330]:
A[0][0]


Out[330]:
3.9689203201800956

In [240]:
np.std(S[:,0])


Out[240]:
1.2432954748161231

In [241]:
plt.hist(S[:,0],bins=50)
plt.show()



In [ ]:


In [215]:
plt.hist(S[:,0],bins=50)
plt.show()



In [216]:
C[1,1:10]


Out[216]:
array([ 1.05778373, -0.05881601,  0.00954084, -0.02052903, -0.0627378 ,
        0.01765268, -0.01276595, -0.03752322, -0.00955641])

In [190]:
C2[1,1:10]


Out[190]:
matrix([[ 0.97093395,  0.00483192, -0.00124857, -0.00134383, -0.04884857,
         -0.01170613, -0.03493499, -0.01353647,  0.00439961]])

In [191]:
A[1]


Out[191]:
array([[ -3.23330264e-02,  -5.42963534e-02,   2.91393589e-02, ...,
         -9.08881444e-05,   3.17666129e-03,   9.54992063e-03],
       [ -3.81267195e-03,  -1.09199626e-02,   2.85962102e-03, ...,
          2.61187388e-02,   6.81834340e-03,  -2.59857166e-02],
       [ -1.13351998e-02,   1.66869346e-02,  -8.59725941e-03, ...,
          4.17269658e-03,  -3.23213605e-02,  -6.76938947e-02],
       ..., 
       [ -3.22049552e-02,  -1.86264279e-03,  -1.72076189e-02, ...,
          3.40683941e-02,   1.97703868e-02,   8.70328792e-03],
       [  3.09943079e-04,   5.13518582e-02,  -1.01703687e-02, ...,
          4.05890881e-04,   5.91430163e-02,  -7.23158034e-02],
       [ -8.44677541e-03,  -2.39635493e-02,   1.15079190e-02, ...,
          2.13802364e-02,  -3.31688662e-02,   2.29927130e-02]])

In [192]:
np.var(C[0,:])


Out[192]:
0.0021214258020596241

In [193]:
plt.matshow(C2)
plt.show()



In [194]:
plt.plot(np.arange(C.shape[0]), C[:,3])
plt.show()



In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [325]:
from scipy.stats import gaussian_kde
density = gaussian_kde(np.real(A[0]))
x = np.arange(0., 8, .1)
plt.plot(x, density(x))
plt.show()



In [280]:
import pandas as pd
df = pd.DataFrame(np.real(A[0]))
df.plot(kind='density')


Out[280]:
<matplotlib.axes._subplots.AxesSubplot at 0x123fc5390>

In [172]:
mean(np.real(A))


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-172-f31bb038b40e> in <module>()
----> 1 mean(np.real(A))

NameError: name 'mean' is not defined

In [ ]:


In [60]:
import csv

In [61]:
with open('/Users/jul/git/pipe-generate-dataset/dataset.csv', 'r') as csvfile:
    reader = csv.reader(csvfile, delimiter=',')
    dataset = np.array(list(reader)).astype("float")

In [62]:
dataset.shape


Out[62]:
(1000, 768)

In [63]:
with open('/Users/jul/git/pipe-generate-dataset/classMatrix.csv', 'r') as csvfile:
    reader = csv.reader(csvfile, delimiter=',')
    dataClass = np.array(list(reader)).astype("float")

In [64]:
dataClass


Out[64]:
array([[ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       ..., 
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.]])

In [86]:
from matplotlib.mlab import PCA
model = PCA(dataset, standardize=False)

In [87]:
model.Y[:,0]


Out[87]:
array([  1.13209968e+09,   1.39246954e+09,   1.33643648e+09,
         1.45046945e+09,   1.61032191e+09,   1.27310507e+09,
         1.81382487e+09,   1.21403919e+09,   1.63738196e+09,
         1.67249709e+09,   1.84033102e+09,   1.53927386e+09,
         2.05963286e+09,   1.29978829e+09,   1.16866316e+09,
         1.61257163e+09,   1.02352342e+09,   1.02295858e+09,
         1.45688241e+09,   1.63637982e+09,   1.26973874e+09,
         1.15310514e+09,   1.63498985e+09,   1.34311338e+09,
         1.39670652e+09,   9.82014429e+08,   6.32647906e+08,
         1.37874014e+09,   1.20267404e+09,   1.46346257e+09,
         9.75242272e+08,   9.84675272e+08,   2.09757293e+09,
         1.30760963e+09,   9.73991287e+08,   1.43533068e+09,
         1.19612206e+09,   1.71973123e+09,   1.01400450e+09,
         1.37629225e+09,   1.70546931e+09,   8.23144220e+08,
         1.89368197e+09,   1.82890075e+09,   9.99906753e+08,
         1.22853656e+09,   1.17308223e+09,   1.25100311e+09,
         1.33984538e+09,   1.00280925e+09,   1.88341651e+09,
         1.45876370e+09,   1.50331363e+09,   1.58479288e+09,
         1.98497341e+09,   1.11122085e+09,   1.26426268e+09,
         1.11699715e+09,   1.02217917e+09,   1.40297270e+09,
         1.77799144e+09,   1.77938504e+09,   1.31059447e+09,
         1.17682795e+09,   1.59280858e+09,   1.19418377e+09,
         1.34404853e+09,   2.13103050e+09,   2.17816274e+09,
         1.55256761e+09,   1.33106046e+09,   1.62281100e+09,
         1.72892284e+09,   1.91434998e+09,   1.73565580e+09,
         1.03276466e+09,   1.55452353e+09,   1.32289163e+09,
         1.35060969e+09,   1.49522536e+09,   1.91967435e+09,
         1.30304602e+09,   1.27747967e+09,   2.25998970e+09,
         1.45198177e+09,   1.33076704e+09,   1.62114294e+09,
         1.14085822e+09,   1.24233841e+09,   1.63874276e+09,
         1.66234434e+09,   1.23122576e+09,   1.62476861e+09,
         1.63900856e+09,   1.23113677e+09,   1.57441533e+09,
         1.43496665e+09,   1.76888319e+09,   1.56147840e+09,
         1.21336210e+09,   1.35763988e+09,   1.05538907e+09,
         1.60168344e+09,   8.84453751e+08,   1.68521119e+09,
         1.17359274e+09,   1.62030883e+09,   1.68040874e+09,
         1.40270796e+09,   2.01672186e+09,   1.61039081e+09,
         1.78302656e+09,   8.99268230e+08,   1.44899356e+09,
         1.36391255e+09,   1.14973451e+09,   9.36325409e+08,
         2.07151963e+09,   1.56580114e+09,   1.28758447e+09,
         1.19624543e+09,   1.92450754e+09,   1.97280008e+09,
         1.73416768e+09,   1.35873908e+09,   1.17540526e+09,
         8.70352272e+08,   1.10319745e+09,   1.13366349e+09,
         1.58328672e+09,   1.75431637e+09,   1.45437489e+09,
         1.84098645e+09,   8.22931165e+08,   7.73136464e+08,
         1.61604986e+09,   1.99551502e+09,   1.37090855e+09,
         8.07342566e+08,   8.85316142e+08,   1.06768958e+09,
         1.02589752e+09,   1.67546607e+09,   1.54623181e+09,
         1.66530401e+09,   2.04271963e+09,   1.81140407e+09,
         9.97341420e+08,   1.59306693e+09,   1.15897449e+09,
         1.48521930e+09,   1.58135691e+09,   1.78349352e+09,
         1.56689587e+09,   1.36312500e+09,   1.64719882e+09,
         1.38585979e+09,   8.67998442e+08,   1.05300715e+09,
         1.56386087e+09,   1.81525311e+09,   8.69217501e+08,
         1.89427003e+09,   2.00795288e+09,   1.00225215e+09,
         1.20415151e+09,   1.65374585e+09,   1.07146246e+09,
         1.53919957e+09,   1.45826865e+09,   1.08548254e+09,
         1.39453665e+09,   1.90456476e+09,   1.66539886e+09,
         1.58282169e+09,   1.16713199e+09,   1.74205274e+09,
         1.37952242e+09,   4.94630704e+08,   1.64059202e+09,
         1.27640803e+09,   1.67971500e+09,   1.13713965e+09,
         1.78222848e+09,   1.62959325e+09,   2.15414935e+09,
         1.23882762e+09,   1.18065494e+09,   2.02654215e+09,
         1.22546970e+09,   1.38074410e+09,   1.35677577e+09,
         1.56678786e+09,   1.54035773e+09,   1.02673343e+09,
         1.36225632e+09,   1.58350607e+09,   1.72686830e+09,
         1.75514108e+09,   2.04433945e+09,   8.41663142e+08,
         1.79266704e+09,   1.63144391e+09,   1.04761149e+09,
         9.06325873e+08,   1.61408363e+09,   1.35337508e+09,
         1.53589100e+09,   1.38990068e+09,   9.21266037e+08,
         1.40691395e+09,   1.53032158e+09,   1.30073743e+09,
         8.48338233e+08,   1.17503523e+09,   1.87387640e+09,
         1.10975184e+09,   1.45738152e+09,   1.68481684e+09,
         1.11273877e+09,   1.23226249e+09,   1.43693579e+09,
         9.55538016e+08,   1.94286916e+09,   1.14051525e+09,
         1.59852268e+09,   1.63056920e+09,   1.47940118e+09,
         1.87941001e+09,   1.82316038e+09,   1.13076228e+09,
         1.76198880e+09,   1.94130433e+09,   1.30308118e+09,
         1.57493147e+09,   1.97065581e+09,   1.51300656e+09,
         1.73005115e+09,   1.00016132e+09,   8.76527889e+08,
         1.47481544e+09,   1.96814518e+09,   1.42305529e+09,
         1.17605551e+09,   1.58706728e+09,   2.09154079e+09,
         9.44124306e+08,   1.96373140e+09,   1.71432310e+09,
         1.45415806e+09,   1.99972785e+09,   1.67848303e+09,
         9.11836780e+08,   1.56676707e+09,   1.58892597e+09,
         1.73041995e+09,   1.88300700e+09,   1.40585342e+09,
         1.87540976e+09,   1.24546753e+09,   1.40529601e+09,
         1.11791069e+09,   1.25993810e+09,   1.12000728e+09,
         1.04460491e+09,   1.64621678e+09,   1.28061022e+09,
         1.23961002e+09,   1.60711551e+09,   1.36106928e+09,
         1.24468219e+09,   1.23369453e+09,   1.18334108e+09,
         8.88234059e+08,   1.55737761e+09,   1.84290641e+09,
         1.35943655e+09,   1.69549355e+09,   1.76541443e+09,
         7.48935715e+08,   1.93203545e+09,   9.97569490e+08,
         1.43849110e+09,   1.12544746e+09,   1.00973109e+09,
         1.59333329e+09,   1.80737129e+09,   2.09097459e+09,
         7.97463135e+08,   1.15831760e+09,   1.14371857e+09,
         1.72833028e+09,   1.34433858e+09,   1.21320744e+09,
         1.59185388e+09,   1.53868854e+09,   1.89948838e+09,
         1.27082285e+09,   1.30007750e+09,   1.21828006e+09,
         1.69076861e+09,   1.22101130e+09,   1.50025354e+09,
         1.00657819e+09,   1.25550959e+09,   1.26720153e+09,
         1.08878571e+09,   1.58469053e+09,   1.33496509e+09,
         1.18605998e+09,   1.05375402e+09,   1.66837491e+09,
         5.64289062e+08,   1.46602605e+09,   1.40855814e+09,
         2.01457830e+09,   1.56125624e+09,   1.31904838e+09,
         1.50991268e+09,   1.41871197e+09,   1.63592782e+09,
         1.38722447e+09,   1.07777693e+09,   1.85486763e+09,
         1.18806965e+09,   1.94526326e+09,   1.47321975e+09,
         7.50289217e+08,   1.36370745e+09,   1.10098103e+09,
         1.33636606e+09,   1.77219114e+09,   1.05154344e+09,
         1.18443387e+09,   1.02708113e+09,   1.31613236e+09,
         2.03306298e+09,   8.76035292e+08,   1.47534575e+09,
         5.35230311e+08,   7.41085310e+08,   1.43743627e+09,
         6.82678108e+08,   1.55947742e+09,   1.41235626e+09,
         1.74979574e+09,   1.06197994e+09,   1.44247860e+09,
         1.94635121e+09,   1.18335039e+09,   1.99984822e+09,
         1.36743062e+09,   1.59935501e+09,   1.23452261e+09,
         1.37535087e+09,   1.84495538e+09,   1.15517095e+09,
         1.48638332e+09,   9.87497365e+08,   1.44905482e+09,
         1.07076437e+09,   1.08311674e+09,   1.13260537e+09,
         1.37618937e+09,   1.29977549e+09,   1.26318323e+09,
         1.80942899e+09,   1.48652889e+09,   1.08144831e+09,
         2.16181523e+09,   1.77512132e+09,   1.05160098e+09,
         1.14207305e+09,   1.86761310e+09,   9.91736111e+08,
         1.43464045e+09,   1.38386147e+09,   1.51276331e+09,
         1.45760906e+09,   1.63269764e+09,   1.03717972e+09,
         1.63806023e+09,   9.43992124e+08,   1.13479076e+09,
         1.73317450e+09,   8.51992315e+08,   1.33901569e+09,
         1.83983544e+09,   9.71867799e+08,   1.53890743e+09,
         9.03109237e+08,   1.57661986e+09,   1.04087096e+09,
         1.22342393e+09,   1.51898113e+09,   1.54967693e+09,
         1.20362563e+09,   1.33412587e+09,   1.56931332e+09,
         1.60020890e+09,   1.31596686e+09,   1.33895801e+09,
         2.00990037e+09,   2.13910140e+09,   1.10786212e+09,
         1.30556548e+09,   9.95206252e+08,   1.26372851e+09,
         1.34640196e+09,   1.83055613e+09,   1.15071722e+09,
         1.51470191e+09,   1.28594125e+09,   1.86013571e+09,
         1.72826221e+09,   1.69647478e+09,   1.34691301e+09,
         1.77491682e+09,   1.18464144e+09,   1.54747897e+09,
         1.80677826e+09,   1.24543597e+09,   7.87162845e+08,
         1.48756414e+09,   1.28567051e+09,   1.64052506e+09,
         1.42509760e+09,   1.37327373e+09,   1.11971402e+09,
         1.21035294e+09,   1.39702326e+09,   1.61804459e+09,
         1.72250186e+09,   1.11941047e+09,   1.78467947e+09,
         1.71200286e+09,   1.14302742e+09,   1.23278045e+09,
         1.29569402e+09,   1.28996875e+09,   1.10053997e+09,
         1.07861328e+09,   1.55059263e+09,   1.68802361e+09,
         1.39926241e+09,   1.42218289e+09,   1.64955723e+09,
         1.45943877e+09,   1.49117450e+09,   1.62070088e+09,
         1.06215868e+09,   1.26483010e+09,   1.39661172e+09,
         2.14453968e+09,   1.55026714e+09,   1.01326750e+09,
         1.66720924e+09,   1.90661259e+09,   1.58121028e+09,
         1.05917386e+09,   1.58645181e+09,   1.44210476e+09,
         1.62711674e+09,   1.43640463e+09,   1.03727426e+09,
         1.20096472e+09,   9.40617128e+08,   1.29612118e+09,
         1.16324330e+09,   1.97083694e+09,   2.23648391e+09,
         1.40080790e+09,   1.06222674e+09,   1.58602599e+09,
         1.45409425e+09,   1.47422639e+09,   1.53995451e+09,
         1.68005928e+09,   1.44933185e+09,   1.80091600e+09,
         1.98197511e+09,   1.42185862e+09,   1.49737098e+09,
         1.91620307e+09,   1.72844362e+09,   1.57232355e+09,
         1.54319673e+09,   1.61131261e+09,   1.24549300e+09,
         1.70568688e+09,   1.50139263e+09,   1.30965520e+09,
         1.15581088e+09,   1.51637496e+09,   1.35859969e+09,
         1.72381067e+09,   1.03070048e+09,   1.11198213e+09,
         1.43437196e+09,   1.57194240e+09,  -1.89485701e+09,
        -1.11327531e+09,  -9.06758100e+08,  -5.06301275e+08,
        -1.25244503e+09,  -1.98433560e+09,  -1.26606297e+09,
        -1.49207430e+09,  -1.00710629e+09,  -7.70171579e+08,
        -1.03807210e+09,  -1.05649812e+09,  -1.60280148e+09,
        -1.30516719e+09,  -1.93590029e+09,  -1.11657604e+09,
        -1.85430135e+09,  -1.22931195e+09,  -1.32972782e+09,
        -1.29465502e+09,  -4.31436603e+08,  -1.40350262e+09,
        -1.27415161e+09,  -2.06950387e+09,  -2.03355533e+09,
        -1.57188494e+09,  -1.23498605e+09,  -2.27339543e+09,
        -1.55874542e+09,  -1.14541462e+09,  -8.95677914e+08,
        -1.32830829e+09,  -1.47476938e+09,  -2.04702161e+09,
        -2.03867754e+09,  -2.37603775e+09,  -1.65809689e+09,
        -1.27475036e+09,  -1.29010049e+09,  -1.85990944e+09,
        -1.20021931e+09,  -1.56836056e+09,  -1.20370421e+09,
        -1.36374635e+09,  -1.22433418e+09,  -1.42506191e+09,
        -9.56303062e+08,  -1.25852180e+09,  -1.44347172e+09,
        -1.48659365e+09,  -1.61826243e+09,  -7.34210167e+08,
        -2.08825804e+09,  -8.30539433e+08,  -1.43870641e+09,
        -9.40966253e+08,  -1.62797364e+09,  -1.43594026e+09,
        -1.29704412e+09,   4.96051463e+07,  -1.10716562e+09,
        -1.68141574e+09,  -7.06016173e+08,  -2.16621896e+09,
        -1.87563724e+09,  -1.87723748e+08,  -1.54762073e+09,
        -1.79972552e+09,  -1.03999425e+09,  -8.71794208e+08,
        -1.18820235e+09,  -2.05825774e+09,  -1.61137507e+09,
        -1.68921799e+09,  -1.09647685e+09,  -1.36975565e+09,
        -1.43676097e+09,  -1.65133133e+09,  -2.16740733e+09,
        -1.70351610e+09,  -1.10090510e+09,  -1.14008119e+09,
        -1.65204773e+09,  -1.54109665e+09,  -1.90240301e+09,
        -1.49244381e+09,  -2.27981378e+09,  -1.81461130e+09,
        -2.16881519e+09,  -8.52715780e+08,  -1.38105016e+09,
        -1.36006047e+09,  -1.59856853e+09,  -1.48847491e+09,
        -1.33979536e+09,  -2.09185681e+09,  -2.19516582e+09,
        -9.03407621e+08,  -1.52311415e+09,  -1.86082554e+09,
        -1.49630543e+09,  -1.59672947e+09,  -1.78463975e+09,
        -2.27424814e+09,  -1.90857204e+09,  -8.54415987e+08,
        -1.13109263e+09,  -1.64656080e+09,  -1.46715069e+09,
        -2.46089441e+09,  -1.05481628e+09,  -1.76680371e+09,
        -1.50045255e+09,  -1.17567042e+09,  -1.99042024e+09,
        -1.58209539e+09,  -1.91319589e+09,  -1.41003861e+09,
        -1.72694349e+09,  -9.02638872e+08,  -1.51189910e+09,
        -1.62850189e+09,  -1.39712561e+09,  -1.71452754e+09,
        -7.51624185e+08,  -1.63627015e+09,  -7.88857053e+08,
        -2.00074327e+09,  -6.81111486e+08,  -8.88891249e+08,
        -1.10160079e+09,  -1.61299767e+09,  -1.61397110e+09,
        -1.07528149e+09,  -1.14596717e+09,  -2.79850077e+09,
        -1.97846047e+09,  -1.22891397e+09,  -1.19735602e+09,
        -1.22231418e+09,  -8.01710641e+08,  -6.44998200e+08,
        -8.67206841e+08,  -5.05267268e+08,  -9.15699984e+08,
        -2.10869347e+09,  -1.09398920e+09,  -1.22124142e+09,
        -1.40206193e+09,  -1.52316960e+09,  -7.53272680e+08,
        -2.14440206e+09,  -2.00170873e+09,  -6.70130968e+08,
        -1.30356384e+09,  -1.80811625e+09,  -1.40733976e+09,
        -1.69965510e+09,  -2.21713514e+09,  -4.27428481e+08,
        -8.79444519e+08,  -2.32495713e+09,  -1.45212247e+09,
        -1.38004875e+09,  -7.77054228e+08,  -1.05065352e+09,
        -1.95992742e+09,  -9.25548436e+08,  -2.04340435e+09,
        -1.19601537e+09,  -1.71735384e+09,  -1.40824726e+09,
        -8.00599640e+08,  -1.47662492e+09,  -1.06722367e+09,
        -1.06608254e+09,  -8.79689340e+08,  -1.61350818e+09,
        -2.39492843e+09,  -1.59254099e+09,  -1.37165502e+09,
        -2.21838964e+09,  -7.34027245e+08,  -1.64943496e+09,
        -1.27789089e+09,  -1.14941799e+09,  -1.86012446e+09,
        -5.95957166e+08,  -1.23507719e+09,  -1.08897465e+09,
        -2.87452316e+09,  -7.53972045e+08,  -1.18518297e+09,
        -2.15785328e+09,  -9.36200785e+08,  -1.28474014e+09,
        -9.04866703e+08,  -2.29671804e+09,  -1.96634892e+09,
        -2.23841433e+09,  -1.34106545e+09,  -1.83788668e+09,
        -1.00246316e+09,  -1.55852239e+09,  -1.14370491e+09,
        -2.23107789e+09,  -1.02839750e+09,  -1.33075452e+09,
        -4.66480472e+08,  -1.90574655e+09,  -1.28575432e+09,
        -1.86127826e+09,  -1.38329700e+09,  -9.98205749e+08,
        -1.42327574e+09,  -1.78605635e+09,  -1.97609144e+09,
        -8.97339914e+08,  -1.40562003e+09,  -1.12791091e+09,
        -1.33225697e+09,  -1.83954894e+09,  -1.46043813e+09,
        -2.07353512e+09,  -1.28254998e+09,  -7.21566833e+08,
        -1.46988435e+09,  -1.94868400e+09,  -1.14986335e+09,
        -1.09696617e+09,  -7.58159986e+08,  -1.40628525e+09,
        -1.33465444e+09,  -1.42192630e+09,  -1.79344396e+09,
        -1.64152918e+09,  -1.55146688e+09,  -1.60165648e+09,
        -1.36743218e+09,  -1.33900831e+09,  -1.00517981e+09,
        -8.28271019e+08,  -1.29397055e+09,  -9.65617486e+08,
        -1.08523605e+09,  -7.39388494e+08,  -1.73259794e+09,
        -2.37280937e+09,  -5.45903911e+08,  -1.87353713e+09,
        -2.14354601e+09,  -1.87257995e+09,  -1.73880041e+09,
        -1.22876813e+09,  -1.98268252e+09,  -1.70942907e+09,
        -1.49630826e+09,  -1.78839092e+09,  -1.48473605e+09,
        -1.44836892e+09,  -2.20393121e+09,  -5.28432513e+08,
        -1.06821722e+09,  -1.77469842e+09,  -1.78736279e+09,
        -1.88854320e+09,  -9.90215653e+08,  -1.68322086e+09,
        -6.91703133e+08,  -6.42446939e+08,  -9.18404639e+08,
        -8.55293685e+08,  -1.08700000e+09,  -1.07451122e+09,
        -1.88428590e+09,  -1.58639881e+09,  -1.31350105e+09,
        -1.32163364e+09,  -1.32966637e+09,  -1.25881181e+09,
        -2.62435486e+09,  -1.15234346e+09,  -1.03550693e+09,
        -1.59532960e+09,  -1.05181167e+09,  -1.55830397e+09,
        -1.23864891e+09,  -1.55797803e+09,  -1.90462298e+09,
        -1.68006211e+09,  -1.14284775e+09,  -6.65324643e+08,
        -1.43791249e+09,  -1.65920947e+09,  -7.07640165e+08,
        -1.08568065e+09,  -1.46726455e+09,  -1.45330177e+09,
        -2.09801647e+08,  -1.29738981e+09,  -2.07957978e+09,
        -1.57202200e+09,  -1.50584098e+09,  -1.69523826e+09,
        -7.65928883e+08,  -1.22726909e+09,  -1.50247014e+09,
        -1.16851250e+09,  -1.44760466e+09,  -1.49071483e+09,
        -1.25499684e+09,  -1.41433561e+09,  -7.00909829e+08,
        -1.02774417e+09,  -3.25013373e+08,  -1.21214709e+09,
        -1.76341526e+09,  -1.03672386e+09,  -1.38163840e+09,
        -1.11217595e+09,  -1.52861525e+09,  -5.70733092e+08,
        -9.40421267e+08,  -1.63176465e+09,  -1.39018327e+09,
        -1.31748539e+09,  -1.15596226e+09,  -2.22393918e+09,
        -1.61090569e+09,  -1.29039845e+09,  -1.43982143e+09,
        -1.23747300e+09,  -1.11150379e+09,  -2.30443898e+09,
        -1.65055139e+09,  -1.62531672e+09,  -9.28861558e+08,
        -1.88117695e+09,  -2.36348021e+09,  -1.73495990e+09,
        -1.84647401e+09,  -1.74772615e+09,  -1.85771440e+09,
        -9.86635644e+08,  -8.83077208e+08,  -2.13343564e+09,
        -1.45688779e+09,  -2.16999992e+09,  -1.02203078e+09,
        -1.81146886e+09,  -9.41042400e+08,  -1.71953149e+09,
        -1.62074273e+09,  -2.28231237e+09,  -2.16932499e+09,
        -1.42835478e+09,  -1.93959980e+09,  -2.07333713e+09,
        -1.85128447e+09,  -8.03355969e+08,  -9.27193233e+08,
        -1.21674610e+09,  -1.03843169e+09,  -1.43936129e+09,
        -1.23074905e+09,  -1.44664126e+09,  -1.41561874e+09,
        -1.33819718e+09,  -1.13402632e+09,  -1.06479236e+09,
        -1.22591503e+09,  -1.88655557e+09,  -1.85963642e+09,
        -7.97544538e+08,  -1.21422439e+09,  -1.74785433e+09,
        -1.91117716e+09,  -9.99450262e+08,  -1.57956705e+09,
        -1.86784003e+09,  -1.21964481e+09,  -1.32039415e+09,
        -1.29274498e+09,  -1.52662091e+09,  -2.01030977e+09,
        -5.49253726e+08,  -1.16122990e+09,  -9.81414760e+08,
        -8.87630673e+08,  -1.23038422e+09,  -1.24895963e+09,
        -2.18391416e+09,  -1.75066509e+09,  -1.50594869e+09,
        -1.83308036e+09,  -1.31370321e+09,  -1.81206885e+09,
        -1.42770419e+09,  -1.72912472e+09,  -1.10670660e+09,
        -1.08641691e+09,  -1.66850816e+09,  -1.81552646e+09,
        -1.13513424e+09,  -5.60542563e+08,  -5.43998985e+08,
        -1.38863058e+09,  -1.36932519e+09,  -1.64910061e+09,
        -2.27767186e+09,  -6.38076771e+08,  -1.47203888e+09,
        -7.45273212e+08,  -1.20429417e+09,  -1.71927855e+09,
        -2.24306897e+09,  -1.41486011e+09,  -1.36574446e+09,
        -1.95689693e+09,  -2.35526966e+09,  -2.08895491e+09,
        -1.90827929e+09,  -1.06211744e+09,  -4.29054945e+08,
        -7.35219372e+08,  -2.19726959e+09,  -5.22052077e+08,
        -1.68481670e+09,  -2.08541776e+09,  -1.83066836e+09,
        -1.53386054e+09,  -1.11406024e+09,  -6.83268966e+08,
        -1.36162818e+09,  -1.50855011e+09,  -1.52670100e+09,
        -2.51817095e+09,  -1.05888183e+09,  -9.30050717e+08,
        -1.55970649e+09,  -1.85663534e+09,  -1.53680594e+09,
        -1.50671990e+09,  -1.63593105e+09,  -1.24915540e+09,
        -1.78079304e+09,  -1.68292801e+09,  -1.33405370e+09,
        -1.70551141e+09,  -8.53198035e+08,  -9.70803795e+08,
        -1.80468588e+09,  -7.47349693e+08,  -1.07502495e+09,
        -1.65311474e+09,  -2.02417995e+09,  -7.47152972e+08,
        -1.18479565e+09,  -1.76963881e+09,  -9.14535335e+08,
        -1.44772568e+09,  -1.56081682e+09,  -1.36503438e+09,
        -1.66113169e+09,  -1.90830045e+09,  -1.97164048e+09,
        -2.13905340e+09,  -1.81643053e+09,  -1.33966197e+09,
        -1.99377172e+09,  -1.46080823e+09,  -2.21257683e+09,
        -4.68982342e+08,  -1.40019080e+09,  -9.26865257e+08,
        -1.45130617e+09,  -8.43959867e+08,  -8.87996722e+08,
        -1.13858298e+09,  -1.77424822e+09,  -2.60584077e+09,
        -2.55493788e+09,  -1.52997958e+09,  -1.22731864e+09,
        -2.01090134e+09,  -1.93407933e+09,  -1.50857751e+09,
        -1.94152335e+09,  -1.06478111e+09,  -1.35836802e+09,
        -8.59855439e+08,  -7.58141748e+08,  -7.60587565e+08,
        -1.54659961e+09,  -1.10676936e+09,  -1.55131027e+09,
        -1.01412277e+09,  -8.29397325e+08,  -1.64519070e+09,
        -1.71262617e+09])

In [88]:
plt.scatter(model.Y[:,0], model.Y[:,1])


Out[88]:
<matplotlib.collections.PathCollection at 0x111894550>

In [90]:
plt.scatter(np.arange(dataset.shape[1]), model.a[0,:])


Out[90]:
<matplotlib.collections.PathCollection at 0x1141956a0>

In [71]:
plt.scatter(np.arange(dataset.shape[1]), np.std(model.a[:,:], 0))


Out[71]:
<matplotlib.collections.PathCollection at 0x11054f898>

In [75]:
plt.scatter(np.arange(dataset.shape[1]), model.a[1,:])


Out[75]:
<matplotlib.collections.PathCollection at 0x1123f6b70>

In [79]:
plt.scatter(np.arange(dataset.shape[1]), np.std(model.a[:,:], 0))


Out[79]:
<matplotlib.collections.PathCollection at 0x1117def98>

In [ ]: