packages feed

dataframe-learn 1.1.0.0 → 1.1.0.1

raw patch · 2 files changed

+18/−4 lines, 2 filesdep ~parallelPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: parallel

API changes (from Hackage documentation)

Files

dataframe-learn.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               dataframe-learn-version:            1.1.0.0+version:            1.1.0.1 synopsis:           Interpretable, expression-returning machine learning for the dataframe ecosystem. description:     A small scikit-learn-style ML library where every model returns both an@@ -82,7 +82,7 @@                         random >= 1.2 && < 2,                         dataframe-core ^>= 1.1,                         dataframe-operations ^>= 1.1.1,-                        text >= 2.0 && < 3,+                        text >= 2.1 && < 3,                         vector ^>= 0.13,                         vector-algorithms ^>= 0.9     hs-source-dirs:     src
src/DataFrame/Featurize/Internal.hs view
@@ -31,6 +31,7 @@ import qualified Data.Vector as V import qualified Data.Vector.Unboxed as VU +import DataFrame.Errors (DataFrameException (..), TypeErrorContext (..)) import qualified DataFrame.Functions as F import DataFrame.Internal.Column (Columnable) import DataFrame.Internal.DataFrame (DataFrame, columnNames)@@ -53,8 +54,19 @@     colMajor = V.fromList (map column names)     column name = case columnAsDoubleVector (F.col @Double name) df of         Right v -> v-        Left e -> throw e+        Left e -> throw (asFeatureError name e) +asFeatureError :: T.Text -> DataFrameException -> DataFrameException+asFeatureError name (TypeMismatchException ctx) =+    TypeMismatchException+        ctx+            { errorColumnName = Just (T.unpack name)+            , callingFunctionName =+                Just+                    "model fit (feature columns must be numeric Double; drop or encode non-numeric columns)"+            }+asFeatureError _ e = e+ -- | The target column as a vector of doubles. targetDoubles :: Expr Double -> DataFrame -> VU.Vector Double targetDoubles expr df = case columnAsDoubleVector expr df of@@ -85,7 +97,9 @@   where     names = map columnExprName features     cols = map (materializeColumn df) features-    n = if null cols then 0 else VU.length (head cols)+    n = case cols of+        (x: _) -> VU.length x+        _      -> 0     d = length cols     rows = V.generate n (\i -> VU.generate d (\j -> (cols !! j) VU.! i))