dataframe-operations 2.5.0.0 → 2.5.0.1
raw patch · 4 files changed
+19/−12 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- dataframe-operations.cabal +1/−1
- src-internal/DataFrame/Internal/Statistics.hs +9/−6
- src/DataFrame/Functions.hs +5/−4
- src/DataFrame/Operations/Typing.hs +4/−1
dataframe-operations.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name: dataframe-operations-version: 2.5.0.0+version: 2.5.0.1 synopsis: Column operations, expression DSL, and statistics for the dataframe ecosystem. description: Untyped column operations (select, filter, sort, join, groupBy,
src-internal/DataFrame/Internal/Statistics.hs view
@@ -106,7 +106,7 @@ computeSkewness :: SkewAcc -> Double computeSkewness (SkewAcc n _ m2 m3) | n < 3 = 0 -- or error "skewness of <3 samples"- | otherwise = (sqrt (fromIntegral n - 1) * m3) / sqrt (m2 ^ (3 :: Int))+ | otherwise = (sqrt (fromIntegral n) * m3) / sqrt (m2 ^ (3 :: Int)) {-# INLINE computeSkewness #-} skewness' :: (VU.Unbox a, Real a, Num a) => VU.Vector a -> Double@@ -202,11 +202,14 @@ {-# INLINE interQuartileRange' #-} meanSquaredError :: VU.Vector Double -> VU.Vector Double -> Maybe Double-meanSquaredError target prediction =- let- squareDiff = VU.ifoldl' (\sq i e -> (e - target VU.! i) ^ (2 :: Int) + sq) 0 prediction- in- Just $ squareDiff / fromIntegral (max (VU.length target) (VU.length prediction))+meanSquaredError target prediction+ | VU.length target /= VU.length prediction = Nothing+ | VU.null target = Nothing+ | otherwise =+ Just+ ( VU.sum (VU.zipWith (\t p -> (p - t) ^ (2 :: Int)) target prediction)+ / fromIntegral (VU.length target)+ ) {-# INLINE meanSquaredError #-} mutualInformationBinned ::
src/DataFrame/Functions.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DisambiguateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -317,10 +318,10 @@ Agg ( MergeAgg "mean"- (MeanAcc 0.0 0)- (\(MeanAcc s c) x -> MeanAcc (s + realToFrac x) (c + 1))- (\(MeanAcc s1 c1) (MeanAcc s2 c2) -> MeanAcc (s1 + s2) (c1 + c2))- (\(MeanAcc s c) -> if c == 0 then 0 / 0 else s / fromIntegral c)+ ((0.0, 0) :: (Double, Int))+ (\(!s, !c) x -> (s + realToFrac x, c + 1))+ (\(!s1, !c1) (!s2, !c2) -> (s1 + s2, c1 + c2))+ (\(s, c) -> if c == 0 then 0 / 0 else s / fromIntegral c) ) {-# SPECIALIZE mean :: Expr Double -> Expr Double #-} {-# SPECIALIZE mean :: Expr Float -> Expr Double #-}
src/DataFrame/Operations/Typing.hs view
@@ -355,7 +355,10 @@ EitherRead -> fromVector (V.map ((readEitherRaw @a) . toStr) col) asType :: SafeReadMode -> SchemaType -> Column -> Column- asType mode st c@(PackedText _ _) = asType mode st (materializePacked c)+ asType mode st@(SType (_ :: P.Proxy a)) c@(PackedText _ _) =+ case testEquality (typeRep @a) (typeRep @T.Text) of+ Just Refl -> c+ Nothing -> asType mode st (materializePacked c) asType mode (SType (_ :: P.Proxy a)) c@(BoxedColumn _ (col :: V.Vector b)) = case typeRep @a of App t1 _t2 -> case eqTypeRep t1 (typeRep @Maybe) of Just HRefl -> case testEquality (typeRep @a) (typeRep @b) of