diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-31 10:31:32 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-31 10:31:32 +0000 |
commit | f637161ac988979b35ab7254f753a67df8ec812a (patch) | |
tree | 11291699868a50a8586ac97281ca26dc66209c28 /examples | |
parent | 2facdf74f267ff81645336528a50696f61bb8670 (diff) |
-norm, +rcond, +kronecker
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pca1.hs | 4 |
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 |
22 | pca :: Int -> Mat -> (Vec -> Vec , Vec -> Vec) | 22 | pca :: Int -> Mat -> (Vec -> Vec , Vec -> Vec) |
23 | pca n dataSet = (encode,decode) | 23 | pca 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 | ||
32 | norm = pnorm PNorm2 | ||
33 | |||
32 | main = do | 34 | main = do |
33 | ok <- doesFileExist ("mnist.txt") | 35 | ok <- doesFileExist ("mnist.txt") |
34 | when (not ok) $ do | 36 | when (not ok) $ do |