Hello community, here is the log from the commit of package ghc-hstatistics for openSUSE:Factory checked in at 2017-03-29 13:24:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-hstatistics (Old) and /work/SRC/openSUSE:Factory/.ghc-hstatistics.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-hstatistics" Wed Mar 29 13:24:58 2017 rev:2 rq:480943 version:0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-hstatistics/ghc-hstatistics.changes 2017-03-10 21:38:29.520927118 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-hstatistics.new/ghc-hstatistics.changes 2017-03-29 13:24:58.944965138 +0200 @@ -1,0 +2,10 @@ +Sun Feb 12 14:15:04 UTC 2017 - psimons@suse.com + +- Update to version 0.3 with cabal2obs. + +------------------------------------------------------------------- +Mon Nov 14 09:29:49 UTC 2016 - psimons@suse.com + +- Update to version 0.2.5.4 with cabal2obs. + +------------------------------------------------------------------- Old: ---- hstatistics-0.2.5.3.tar.gz New: ---- hstatistics-0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-hstatistics.spec ++++++ --- /var/tmp/diff_new_pack.g1sA4A/_old 2017-03-29 13:24:59.632867850 +0200 +++ /var/tmp/diff_new_pack.g1sA4A/_new 2017-03-29 13:24:59.636867283 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-hstatistics # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,14 @@ %global pkg_name hstatistics Name: ghc-%{pkg_name} -Version: 0.2.5.3 +Version: 0.3 Release: 0 Summary: Statistics License: BSD-3-Clause -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: BuildRequires: ghc-array-devel BuildRequires: ghc-hmatrix-devel BuildRequires: ghc-hmatrix-gsl-stats-devel @@ -34,7 +33,6 @@ BuildRequires: ghc-rpm-macros BuildRequires: ghc-vector-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build -# End cabal-rpm deps %description Purely functional interface for statistics based on hmatrix and @@ -60,15 +58,12 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %post devel %ghc_pkg_recache @@ -81,6 +76,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) -%doc README +%doc CHANGES README %changelog ++++++ hstatistics-0.2.5.3.tar.gz -> hstatistics-0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hstatistics-0.2.5.3/CHANGES new/hstatistics-0.3/CHANGES --- old/hstatistics-0.2.5.3/CHANGES 2015-10-10 07:49:48.000000000 +0200 +++ new/hstatistics-0.3/CHANGES 2017-02-06 02:48:46.000000000 +0100 @@ -106,3 +106,10 @@ 0.2.5.3: updated for hmatrix 0.17 + +0.2.5.4: + updated for hmatrix 0.18 + +0.3: + changed PCA to use SVD as suggested by Pavol Klacansky + (issue #3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hstatistics-0.2.5.3/hstatistics.cabal new/hstatistics-0.3/hstatistics.cabal --- old/hstatistics-0.2.5.3/hstatistics.cabal 2015-10-10 07:49:48.000000000 +0200 +++ new/hstatistics-0.3/hstatistics.cabal 2017-02-06 02:48:46.000000000 +0100 @@ -1,8 +1,8 @@ Name: hstatistics -Version: 0.2.5.3 +Version: 0.3 License: BSD3 License-file: LICENSE -Copyright: (c) A.V.H. McPhail 2010, 2011, 2012, 2013, 2014 +Copyright: (c) A.V.H. McPhail 2010--2014, 2016, 2017 Author: Vivian McPhail Maintainer: haskell.vivian.mcphail <at> gmail <dot> com Stability: provisional @@ -16,7 +16,7 @@ . Feature requests, suggestions, and bug fixes welcome. Category: Math, Statistics -tested-with: GHC ==7.10.2 +tested-with: GHC ==8.0.1 cabal-version: >=1.8 @@ -30,8 +30,8 @@ Build-Depends: base >= 4 && < 5, array, random, vector, - hmatrix >= 0.17, - hmatrix-gsl-stats >= 0.4 + hmatrix >= 0.18, + hmatrix-gsl-stats >= 0.4.1.6 Extensions: @@ -46,12 +46,9 @@ other-modules: C-sources: - ghc-prof-options: -auto - ghc-options: -Wall -fno-warn-missing-signatures -fno-warn-orphans -fno-warn-unused-binds - -O2 source-repository head type: git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hstatistics-0.2.5.3/lib/Numeric/Statistics/PCA.hs new/hstatistics-0.3/lib/Numeric/Statistics/PCA.hs --- old/hstatistics-0.2.5.3/lib/Numeric/Statistics/PCA.hs 2015-10-10 07:49:48.000000000 +0200 +++ new/hstatistics-0.3/lib/Numeric/Statistics/PCA.hs 2017-02-06 02:48:46.000000000 +0100 @@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Numeric.Statistics.PCA --- Copyright : (c) A. V. H. McPhail 2010, 2014 +-- Copyright : (c) A. V. H. McPhail 2010, 2014, 2017 -- License : BSD3 -- -- Maintainer : haskell.vivian.mcphail <at> gmail <dot> com @@ -27,38 +27,47 @@ import Numeric.GSL.Statistics -import Numeric.Statistics +--import Numeric.Statistics ----------------------------------------------------------------------------- -- | find the principal components of multidimensional data greater than -- the threshhold -pca :: I.Array Int (Vector Double) -- the data +pca :: I.Array Int (Vector Double) -- the data -> Double -- eigenvalue threshold - -> Matrix Double + -> (Vector Double, Matrix Double) -- Eignevalues, Principal components pca d q = let d' = fmap (\x -> x - (scalar $ mean x)) d -- remove the mean from each dimension - cv = covarianceMatrix d' - (val',vec') = eigSH $ trustSym cv -- the covariance matrix is real symmetric - val = toList val' - vec = toColumns vec' - v' = zip val vec + d'' = fromColumns $ I.elems d' + (_,vec',uni') = svd d'' + vec = toList vec' + uni = toColumns uni' + v' = zip vec uni v = filter (\(x,_) -> x > q) v' -- keep only eigens > than parameter - in fromColumns $ snd $ unzip v + (eigs,vs) = unzip v + in (fromList eigs,fromColumns vs) -- | find N greatest principal components of multidimensional data -- according to size of the eigenvalue pcaN :: I.Array Int (Vector Double) -- the data -> Int -- number of components to return - -> Matrix Double + -> (Vector Double, Matrix Double) -- Eignevalues, Principal components pcaN d n = let d' = fmap (\x -> x - (scalar $ mean x)) d -- remove the mean from each dimension - cv = covarianceMatrix d' - (val',vec') = eigSH $ trustSym cv -- the covariance matrix is real symmetric - val = toList val' - vec = toColumns vec' - v' = zip val vec + d'' = fromColumns $ I.elems d' + (_,vec',uni') = svd d'' + vec = toList vec' + uni = toColumns uni' + v' = zip vec uni v = take n $ reverse $ sortBy (comparing fst) v' - in fromColumns $ snd $ unzip v + (eigs,vs) = unzip v + in (fromList eigs,fromColumns vs) +v1 = fromList [1,2,3,4,5,6::Double] +v2 = fromList [2,3,4,5,6,7::Double] +v3 = fromList [3,4,5,6,7,8::Double] + +a = fromColumns [v1,v2,v3] +b = I.listArray (1,3::Int) [v1,v2,v3] :: I.Array Int (Vector Double) + -- | perform a PCA transform of the original data (remove mean) -- | Final = M^T Data^T pcaTransform :: I.Array Int (Vector Double) -- ^ the data @@ -74,11 +83,11 @@ -> I.Array Int (Vector Double) -- ^ the reduced data pcaReduce d q = let u = fmap (scalar . mean) d d' = zipWith (-) (I.elems d) (I.elems u) - cv = covarianceMatrix $ I.listArray (I.bounds d) d' - (val',vec') = eigSH $ trustSym cv -- the covariance matrix is real symmetric - val = toList val' - vec = toColumns vec' - v' = zip val vec + d'' = fromColumns d' + (_,vec',uni') = svd d'' + vec = toList vec' + uni = toColumns uni' + v' = zip vec uni v = filter (\(x,_) -> x > q) v' -- keep only eigens > than parameter m = fromColumns $ snd $ unzip v in I.listArray (I.bounds d) $ zipWith (+) (toRows $ m <> (tr' m) <> fromRows d') (I.elems u) @@ -89,11 +98,11 @@ -> I.Array Int (Vector Double) -- ^ the reduced data, with n principal components pcaReduceN d n = let u = fmap (scalar . mean) d d' = zipWith (-) (I.elems d) (I.elems u) - cv = covarianceMatrix $ I.listArray (I.bounds d) d' - (val',vec') = eigSH $ trustSym cv -- the covariance matrix is real symmetric - val = toList val' - vec = toColumns vec' - v' = zip val vec + d'' = fromColumns d' + (_,vec',uni') = svd d'' + vec = toList vec' + uni = toColumns uni' + v' = zip vec uni v = take n $ reverse $ sortBy (comparing fst) v' m = fromColumns $ snd $ unzip v in I.listArray (I.bounds d) $ zipWith (+) (toRows $ m <> (tr' m) <> fromRows d') (I.elems u) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hstatistics-0.2.5.3/lib/Numeric/Statistics.hs new/hstatistics-0.3/lib/Numeric/Statistics.hs --- old/hstatistics-0.2.5.3/lib/Numeric/Statistics.hs 2015-10-10 07:49:48.000000000 +0200 +++ new/hstatistics-0.3/lib/Numeric/Statistics.hs 2017-02-06 02:48:46.000000000 +0100 @@ -79,7 +79,7 @@ meanArray a = meanList $ I.elems a -- | the mean of a matrix with data series in rows -meanMatrix :: (Container Vector a, Num (Vector a), Element a, Fractional a) => Matrix a -> Sample a +meanMatrix :: (Container Vector a, Num (Vector a), Fractional a) => Matrix a -> Sample a meanMatrix a = meanList $ toRows a ----------------------------------------------------------------------------- @@ -93,11 +93,11 @@ in mxs - msx -- | the variance of an array of vectors -varianceArray :: (Container Vector a, Floating (Vector a), Num a, Fractional a) => Samples a -> Sample a +varianceArray :: (Container Vector a, Floating (Vector a), Fractional a) => Samples a -> Sample a varianceArray a = varianceList $ I.elems a -- | the variance of a matrix with data series in rows -varianceMatrix :: (Container Vector a, Floating (Vector a), Element a, Num a, Fractional a) => Matrix a -> Sample a +varianceMatrix :: (Container Vector a, Floating (Vector a), Fractional a) => Matrix a -> Sample a varianceMatrix a = varianceList $ toRows a ----------------------------------------------------------------------------- @@ -253,7 +253,7 @@ ----------------------------------------------------------------------------- -- | count the number of runs greater than or equal to @n@ in the data -run_count :: (Num a, Num t, Ord b, Ord a, Storable b, Container Vector b) +run_count :: (Num a, Num t, Ord b, Ord a, Container Vector b) => a -- ^ longest run to count -> Vector b -- ^ data -> [(a, t)] -- ^ [(run length,count)]