Чёт data science в прыщесосноле хуевато идёт
import Data.List
import System.Environment
import System.IO
purgeOutliers :: Double -> [Double] -> ([Double], [Double])
purgeOutliers fraction list = let
len = length list
mean = sum list / fromIntegral len
droplen = round $ fromIntegral len * fraction
offsets = map (abs . (subtract mean)) list
boundary = head $ drop droplen $ reverse $ sort offsets
in partition (\x -> abs (x - mean) < boundary) list
main :: IO ()
main = do
args <- getArgs
let fraction = read $ head args
inp <- getContents
let (good, bad) = (purgeOutliers fraction . map read . lines) inp
hPutStr stdout $ unlines $ map show good
hPutStr stderr $ unlines $ map show bad
https://scikit-learn.org/stable/modules/outlier_detection.html
какой-то хуйней занимаешься, если честно
@l29ah если напиасано через numpy, то быстрее