Package src :: Package stats306b :: Package lecture7 :: Module example
[hide private]
[frames] | no frames]

Module example

source code

Functions [hide private]
 
ICAanal(data, ncomp=2)
Return ICA matrix and estimated sources.
source code
 
PCAanal(data, ncomp=2)
Return principal directions and estimated components.
source code
 
offticks(which=['x', 'y'])
Turn off pylab ticks.
source code
 
main(X, pngfile)
Compare PCA and ICA for 2d example X, saving output in pngfile.
source code
Variables [hide private]
  n = 10000
Generate a sample of size 10000 from ...
  S1 = array([[ 1.46750682, 0.0453567...
  A1 = array([[ 2.7, 1....
  X1 = array([[ 3.91691161, 1.4675068...
Generate a sample of size 10000 from ...
  S2 = array([[ 0.37111033, 0.9078241...
  A2 = array([[ 0.5, 0....
  X2 = array([[-0.2683569 , 0.6394672...
Generate a sample of size 10000 from ...
  S3 = array([[ 0.7889333 , 2.0093200...
  A3 = array([[ 0.5, 0....
  X3 = array([[-0.61019339, 1.3991266...
Variables Details [hide private]

n


Generate a sample of size 10000 from 

X = [[2.7,  1], S
     [-1., 0.]]
where

S_1 ~ N(0,1)
S_2 ~ N(0,1) + Bernoulli(0.4) * 7

Value:
10000

S1

Value:
array([[ 1.46750682,  0.04535679],
       [ 1.19830783,  0.60516811],
       [-0.18621321,  7.03127753],
       ..., 
       [-0.3640596 ,  0.78754054],
       [ 0.74362283,  7.50313365],
       [-0.15738583,  1.22573185]])

A1

Value:
array([[ 2.7,  1. ],
       [-1. ,  0. ]])

X1


Generate a sample of size 10000 from 

X = [[0.5,  0.5], S
     [-0.5, 0.5]]
where

S_1 ~ Uniform(0,1)
S_2 ~ Uniform(0,1)

Value:
array([[ 3.91691161,  1.46750682],
       [ 2.63026301,  1.19830783],
       [-7.53405319, -0.18621321],
       ..., 
       [-1.77050145, -0.3640596 ],
       [-5.49535201,  0.74362283],
       [-1.65067359, -0.15738583]])

S2

Value:
array([[ 0.37111033,  0.90782412],
       [ 0.49711313,  0.46028244],
       [ 0.65505216,  0.33777095],
       ..., 
       [ 0.98140891,  0.09288654],
       [ 0.97029406,  0.63051863],
       [ 0.41380279,  0.68438943]])

A2

Value:
array([[ 0.5,  0.5],
       [-0.5,  0.5]])

X2


Generate a sample of size 10000 from 

X = [[0.5,  0.5], S
     [-0.5, 0.5]]
where

S_1 ~ Exponential(1)
S_2 ~ Uniform(0,1) + Exponential(1)

Value:
array([[-0.2683569 ,  0.63946723],
       [ 0.01841535,  0.47869778],
       [ 0.1586406 ,  0.49641156],
       ..., 
       [ 0.44426118,  0.53714772],
       [ 0.16988772,  0.80040634],
       [-0.13529332,  0.54909611]])

S3

Value:
array([[ 0.7889333 ,  2.00932008],
       [ 1.14619009,  1.86130755],
       [ 0.22581963,  0.91688512],
       ..., 
       [ 1.03673462,  0.3731851 ],
       [ 0.59697977,  0.64182534],
       [ 2.5349058 ,  1.75254568]])

A3

Value:
array([[ 0.5,  0.5],
       [-0.5,  0.5]])

X3

Value:
array([[-0.61019339,  1.39912669],
       [-0.35755873,  1.50374882],
       [-0.34553275,  0.57135237],
       ..., 
       [ 0.33177476,  0.70495986],
       [-0.02242278,  0.61940256],
       [ 0.39118006,  2.14372574]])