summaryrefslogtreecommitdiff
path: root/examples/pca1.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-31 10:31:32 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-31 10:31:32 +0000
commitf637161ac988979b35ab7254f753a67df8ec812a (patch)
tree11291699868a50a8586ac97281ca26dc66209c28 /examples/pca1.hs
parent2facdf74f267ff81645336528a50696f61bb8670 (diff)
-norm, +rcond, +kronecker
Diffstat (limited to 'examples/pca1.hs')
-rw-r--r--examples/pca1.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/pca1.hs b/examples/pca1.hs
index 4ad8720..ab3d0b7 100644
--- a/examples/pca1.hs
+++ b/examples/pca1.hs
@@ -21,7 +21,7 @@ cov x = (trans xc <> xc) / fromIntegral (rows x -1)
21-- creates the compression and decompression functions from the desired number of components 21-- creates the compression and decompression functions from the desired number of components
22pca :: Int -> Mat -> (Vec -> Vec , Vec -> Vec) 22pca :: Int -> Mat -> (Vec -> Vec , Vec -> Vec)
23pca n dataSet = (encode,decode) 23pca n dataSet = (encode,decode)
24 where 24 where
25 encode x = vp <> (x - m) 25 encode x = vp <> (x - m)
26 decode x = x <> vp + m 26 decode x = x <> vp + m
27 m = mean dataSet 27 m = mean dataSet
@@ -29,6 +29,8 @@ pca n dataSet = (encode,decode)
29 (_,v) = eigSH c 29 (_,v) = eigSH c
30 vp = takeRows n (trans v) 30 vp = takeRows n (trans v)
31 31
32norm = pnorm PNorm2
33
32main = do 34main = do
33 ok <- doesFileExist ("mnist.txt") 35 ok <- doesFileExist ("mnist.txt")
34 when (not ok) $ do 36 when (not ok) $ do