opto-0.1.0.0: General-purpose performant numeric optimization library

Copyright(c) Justin Le 2019
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Numeric.Opto.Run.Conduit

Contents

Description

Conduits that are useful for sampling and running optimizers.

Synopsis

Sampling conduits

shuffling :: PrimMonad m => Gen (PrimState m) -> ConduitT a a m () Source #

Outputs a shuffled version of the input stream. Keeps entire input stream in memory.

NOTE: Pulls the entire input stream into memory first before outputting anything.

shufflingN :: PrimMonad m => Int -> Gen (PrimState m) -> ConduitT a a m () Source #

Takes the first N items out of the input stream, shuffles them in-memory, and outputs the shuffled result.

Leaves the rest of the items in the stream.

Use forever to repeat multiple times until the stream is exhausted.

sinkSampleReservoir :: forall m v a o. (PrimMonad m, Vector v a) => Int -> Gen (PrimState m) -> ConduitT a o m (v a) Source #

Process an entire stream, and keep N random and shuffled items from that stream. Is O(N) memory.

samplingN :: PrimMonad m => Int -> Gen (PrimState m) -> ConduitT a a m () Source #

Process an entire stream, and yield N random items from that stream. Is O(N) memory.

NOTE: Exhausts the entire input stream first before outputting anything, but never keeps the entire original stream in memory.

skipSampling Source #

Arguments

:: PrimMonad m 
=> Double

probability of pass-through

-> Gen (PrimState m) 
-> ConduitT a a m () 

Drops and lets items through randomly with a given probability.