packages feed

dataframe 0.4.0.2 → 0.4.0.3

raw patch · 3 files changed

+28/−34 lines, 3 files

Files

CHANGELOG.md view
@@ -1,6 +1,6 @@ # Revision history for dataframe -## 0.4.0.2+## 0.4.0.3 * Improved performance for folds and reductions. * Improve standalone mean and correlation functions. * Remove buggy boxedness check in aggregations.
app/Benchmark.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-}  import Data.Time@@ -9,36 +8,31 @@ import qualified DataFrame.Functions as F import System.Random.Stateful -import Data.Text (Text)-import DataFrame ((|>))-import DataFrame.DecisionTree-import DataFrame.Functions ((.=))--$(F.declareColumnsFromCsvFile "../../Downloads/playground-series-s5e11/train.csv")- main :: IO () main = do-    train <- D.readCsv "../../Downloads/playground-series-s5e11/train.csv"-    -- Create a new symbol for loan paid back since we are changing the type.-    let (loanPaidBack, train') =-            train-                |> D.deriveWithExpr-                    (F.name loan_paid_back)-                    (F.lift (round @Double @Int) loan_paid_back)--    let model = fitDecisionTree (TreeConfig 15 2) loanPaidBack (train' |> D.exclude ["id"])-    let trainPred = D.derive "prediction" model train'-    print $-        trainPred-            |> D.groupBy [F.name loanPaidBack, "prediction"]-            |> D.aggregate ["count" .= F.count loanPaidBack]-            |> D.sortBy [D.Desc "prediction", D.Desc (F.name loanPaidBack)]--    test <- D.readCsv "../../Downloads/playground-series-s5e11/test.csv"-    let withPredictions = D.derive "prediction" model test-    D.writeCsv-        "predictions.csv"-        ( withPredictions-            |> D.select ["id", "prediction"]-            |> D.rename "prediction" (F.name loan_paid_back)-        )+    let n = 100_000_000+    g <- newIOGenM =<< newStdGen+    let range = (0 :: Double, 1 :: Double)+    startGeneration <- getCurrentTime+    ns <- VU.replicateM n (uniformRM range g)+    xs <- VU.replicateM n (uniformRM range g)+    ys <- VU.replicateM n (uniformRM range g)+    let df = D.fromUnnamedColumns (map D.fromUnboxedVector [ns, xs, ys])+    print df+    endGeneration <- getCurrentTime+    let generationTime = diffUTCTime endGeneration startGeneration+    putStrLn $ "Data generation Time: " ++ show generationTime+    startCalculation <- getCurrentTime+    print $ D.mean (F.col @Double "0") df+    print $ D.variance (F.col @Double "1") df+    print $ D.correlation "1" "2" df+    endCalculation <- getCurrentTime+    let calculationTime = diffUTCTime endCalculation startCalculation+    putStrLn $ "Calculation Time: " ++ show calculationTime+    startFilter <- getCurrentTime+    print $ D.filter (F.col @Double "0") (> 0.971) df D.|> D.take 10+    endFilter <- getCurrentTime+    let filterTime = diffUTCTime endFilter startFilter+    putStrLn $ "Filter Time: " ++ show filterTime+    let totalTime = diffUTCTime endFilter startGeneration+    putStrLn $ "Total Time: " ++ show totalTime
dataframe.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               dataframe-version:            0.4.0.2+version:            0.4.0.3  synopsis: A fast, safe, and intuitive DataFrame library.