sgd-0.3.5: Stochastic gradient descent

Safe HaskellNone

Numeric.SGD.Dataset

Contents

Description

Dataset abstraction.

Synopsis

Dataset

data Dataset a Source

A dataset with elements of type a.

Constructors

Dataset 

Fields

size :: Int

A size of the dataset.

elemAt :: Int -> IO a

Get dataset element with a given index. The set of indices is of a {0, 1, .., size - 1} form.

Reading

loadData :: Dataset a -> IO [a]Source

Lazily load dataset from a disk.

sample :: RandomGen g => g -> Int -> Dataset a -> IO ([a], g)Source

A dataset sample of the given size.

Construction

withVect :: [a] -> (Dataset a -> IO b) -> IO bSource

Construct dataset from a vector of elements and run the given handler.

withDisk :: Binary a => [a] -> (Dataset a -> IO b) -> IO bSource

Construct dataset from a list of elements, store it on a disk and run the given handler.

withData :: Binary a => Bool -> [a] -> (Dataset a -> IO b) -> IO bSource

Use disk or vector dataset representation depending on the first argument: when True, use withDisk, otherwise use withVect.