@@ -395,8 +395,8 @@ identifyCarePoints ::
395395identifyCarePoints target df indices leftTree rightTree =
396396 case interpret @ a df (Col target) of
397397 Left _ -> []
398- Right (TColumn col ) ->
399- case toVector @ a col of
398+ Right (TColumn column ) ->
399+ case toVector @ a column of
400400 Left _ -> []
401401 Right targetVals ->
402402 V. toList $ V. mapMaybe (checkPoint targetVals) indices
@@ -424,12 +424,12 @@ predictWithTree ::
424424 Int -> -- Row index
425425 Tree a ->
426426 a
427- predictWithTree target df idx (Leaf v) = v
427+ predictWithTree _target _df _idx (Leaf v) = v
428428predictWithTree target df idx (Branch cond left right) =
429429 case interpret @ Bool df cond of
430430 Left _ -> predictWithTree @ a target df idx left -- Default to left on error
431- Right (TColumn col ) ->
432- case toVector @ Bool col of
431+ Right (TColumn column ) ->
432+ case toVector @ Bool column of
433433 Left _ -> predictWithTree @ a target df idx left
434434 Right boolVals ->
435435 if boolVals V. ! idx
@@ -440,8 +440,8 @@ countCarePointErrors :: Expr Bool -> DataFrame -> [CarePoint] -> Int
440440countCarePointErrors cond df carePoints =
441441 case interpret @ Bool df cond of
442442 Left _ -> length carePoints
443- Right (TColumn col ) ->
444- case toVector @ Bool col of
443+ Right (TColumn column ) ->
444+ case toVector @ Bool column of
445445 Left _ -> length carePoints
446446 Right boolVals ->
447447 length $ filter (isMisclassified boolVals) carePoints
@@ -457,8 +457,8 @@ partitionIndices ::
457457partitionIndices cond df indices =
458458 case interpret @ Bool df cond of
459459 Left _ -> (indices, V. empty)
460- Right (TColumn col ) ->
461- case toVector @ Bool col of
460+ Right (TColumn column ) ->
461+ case toVector @ Bool column of
462462 Left _ -> (indices, V. empty)
463463 Right boolVals ->
464464 V. partition (boolVals V. ! ) indices
@@ -473,13 +473,13 @@ majorityValueFromIndices ::
473473majorityValueFromIndices target df indices =
474474 case interpret @ a df (Col target) of
475475 Left e -> throw e
476- Right (TColumn col ) ->
477- case toVector @ a col of
476+ Right (TColumn column ) ->
477+ case toVector @ a column of
478478 Left e -> throw e
479479 Right vals ->
480480 let counts =
481481 V. foldl'
482- (\ acc i -> M. insertWith (+) (vals V. ! i) 1 acc)
482+ (\ acc i -> M. insertWith (+) (vals V. ! i) ( 1 :: Int ) acc)
483483 M. empty
484484 indices
485485 in if M. null counts
@@ -499,8 +499,8 @@ computeTreeLoss target df indices tree
499499 | otherwise =
500500 case interpret @ a df (Col target) of
501501 Left _ -> 1.0
502- Right (TColumn col ) ->
503- case toVector @ a col of
502+ Right (TColumn column ) ->
503+ case toVector @ a column of
504504 Left _ -> 1.0
505505 Right targetVals ->
506506 let
@@ -699,24 +699,26 @@ numericExprsWithTerms cfg df =
699699numericCols :: DataFrame -> [NumExpr ]
700700numericCols df = concatMap extract (columnNames df)
701701 where
702- extract col = case unsafeGetColumn col df of
702+ extract colName = case unsafeGetColumn colName df of
703703 UnboxedColumn Nothing (_ :: VU. Vector b ) ->
704704 case testEquality (typeRep @ b ) (typeRep @ Double ) of
705- Just Refl -> [NDouble (Col col )]
705+ Just Refl -> [NDouble (Col colName )]
706706 Nothing -> case sIntegral @ b of
707- STrue -> [NDouble (F. toDouble (Col @ b col ))]
707+ STrue -> [NDouble (F. toDouble (Col @ b colName ))]
708708 SFalse -> []
709709 BoxedColumn (Just _) (_ :: V. Vector b ) ->
710710 case testEquality (typeRep @ b ) (typeRep @ Double ) of
711- Just Refl -> [NMaybeDouble (Col @ (Maybe b ) col )]
711+ Just Refl -> [NMaybeDouble (Col @ (Maybe b ) colName )]
712712 Nothing -> case sIntegral @ b of
713- STrue -> [NMaybeDouble (F. whenPresent (realToFrac @ b @ Double ) (Col @ (Maybe b ) col))]
713+ STrue ->
714+ [NMaybeDouble (F. whenPresent (realToFrac @ b @ Double ) (Col @ (Maybe b ) colName))]
714715 SFalse -> []
715716 UnboxedColumn (Just _) (_ :: VU. Vector b ) ->
716717 case testEquality (typeRep @ b ) (typeRep @ Double ) of
717- Just Refl -> [NMaybeDouble (Col @ (Maybe b ) col )]
718+ Just Refl -> [NMaybeDouble (Col @ (Maybe b ) colName )]
718719 Nothing -> case sIntegral @ b of
719- STrue -> [NMaybeDouble (F. whenPresent (realToFrac @ b @ Double ) (Col @ (Maybe b ) col))]
720+ STrue ->
721+ [NMaybeDouble (F. whenPresent (realToFrac @ b @ Double ) (Col @ (Maybe b ) colName))]
720722 SFalse -> []
721723 _ -> []
722724
@@ -766,16 +768,18 @@ generateConditionsOld cfg df =
766768 ords = columnOrdering cfg
767769 genConds :: T. Text -> [Expr Bool ]
768770 genConds colName = case unsafeGetColumn colName df of
769- (BoxedColumn Nothing (col :: V. Vector a )) ->
770- case withOrdFrom @ a ords (map (Lit . (`percentileOrd'` col )) [1 , 25 , 75 , 99 ]) of
771+ (BoxedColumn Nothing (column :: V. Vector a )) ->
772+ case withOrdFrom @ a ords (map (Lit . (`percentileOrd'` column )) [1 , 25 , 75 , 99 ]) of
771773 Just ps -> map (F. lift2 (==) (Col @ a colName)) ps
772774 Nothing -> []
773- (BoxedColumn (Just _) (col :: V. Vector a )) -> case sFloating @ a of
775+ (BoxedColumn (Just _) (column :: V. Vector a )) -> case sFloating @ a of
774776 STrue -> [] -- handled by numericCols / numericExprs
775777 SFalse -> case sIntegral @ a of
776778 STrue -> [] -- handled by numericCols / numericExprs
777779 SFalse ->
778- case withOrdFrom @ a ords (map (Lit . Just . (`percentileOrd'` col)) [1 , 25 , 75 , 99 ]) of
780+ case withOrdFrom @ a
781+ ords
782+ (map (Lit . Just . (`percentileOrd'` column)) [1 , 25 , 75 , 99 ]) of
779783 Just ps -> map (F. lift2 (==) (Col @ (Maybe a ) colName)) ps
780784 Nothing -> []
781785 (UnboxedColumn _ (_ :: VU. Vector a )) -> []
@@ -794,7 +798,7 @@ generateConditionsOld cfg df =
794798 ]
795799 where
796800 colConds (! l, ! r) = case (unsafeGetColumn l df, unsafeGetColumn r df) of
797- ( BoxedColumn Nothing (col1 :: V. Vector a )
801+ ( BoxedColumn Nothing (_col1 :: V. Vector a )
798802 , BoxedColumn Nothing (_ :: V. Vector b )
799803 ) ->
800804 case testEquality (typeRep @ a ) (typeRep @ b ) of
@@ -826,7 +830,7 @@ calculateGini target df =
826830 counts = getCounts @ a target df
827831 numClasses = fromIntegral $ M. size counts
828832 probs = map (\ c -> (fromIntegral c + 1 ) / (n + numClasses)) (M. elems counts)
829- in if n == 0 then 0 else 1 - sum (map (^ 2 ) probs)
833+ in if n == 0 then 0 else 1 - sum (map (^ ( 2 :: Int ) ) probs)
830834
831835majorityValue :: forall a . (Columnable a , Ord a ) => T. Text -> DataFrame -> a
832836majorityValue target df =
@@ -840,17 +844,17 @@ getCounts ::
840844getCounts target df =
841845 case interpret @ a df (Col target) of
842846 Left e -> throw e
843- Right (TColumn col ) ->
844- case toVector @ a col of
847+ Right (TColumn column ) ->
848+ case toVector @ a column of
845849 Left e -> throw e
846850 Right vals -> foldl' (\ acc x -> M. insertWith (+) x 1 acc) M. empty (V. toList vals)
847851
848852percentile :: Int -> Expr Double -> DataFrame -> Double
849853percentile p expr df =
850854 case interpret @ Double df expr of
851855 Left _ -> 0
852- Right (TColumn col ) ->
853- case toVector @ Double col of
856+ Right (TColumn column ) ->
857+ case toVector @ Double column of
854858 Left _ -> 0
855859 Right vals ->
856860 let sorted = V. fromList $ sort $ V. toList vals
@@ -898,13 +902,13 @@ probsFromIndices ::
898902probsFromIndices target df indices =
899903 case interpret @ a df (Col target) of
900904 Left _ -> M. empty
901- Right (TColumn col ) ->
902- case toVector @ a col of
905+ Right (TColumn column ) ->
906+ case toVector @ a column of
903907 Left _ -> M. empty
904908 Right vals ->
905909 let counts =
906910 V. foldl'
907- (\ acc i -> M. insertWith (+) (vals V. ! i) 1 acc)
911+ (\ acc i -> M. insertWith (+) (vals V. ! i) ( 1 :: Int ) acc)
908912 M. empty
909913 indices
910914 total = fromIntegral (V. length indices) :: Double
0 commit comments