mnist-idx-0.1.2.6: Read and write IDX data that is used in e.g. the MNIST database.

CopyrightChristof Schramm
LicenseGPL v 3
MaintainerChristof Schramm <christof.schramm@campus.lmu.de>
StabilityExperimental
PortabilityShould work in all common Haskell implementations
Safe HaskellNone
LanguageHaskell2010

Data.IDX

Contents

Description

A package for reading and writing data in the IDX format. This data format is used for machine-learning data sets like the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)

Synopsis

Data types

data IDXData Source #

Datatype for storing IDXData. Internally data is always stored either as Int or Double unboxed vectors. However when binary serialization is used, the data is serialized according to the IDXContentType.

data IDXLabels Source #

A data type that holds Int labels for a set of IDXData

Accessing data

idxType :: IDXData -> IDXContentType Source #

Return the what type the data is stored in

idxDimensions :: IDXData -> Vector Int Source #

Return an unboxed Vector of Int dimensions

isIDXReal :: IDXData -> Bool Source #

Return wether the data in this IDXData value is stored as double values

isIDXIntegral :: IDXData -> Bool Source #

Return wether the data in this IDXData value is stored as integral values

Raw data

idxDoubleContent :: IDXData -> Vector Double Source #

Return contained doubles, if no doubles are contained convert the content to double by using fromIntegral. Data is stored like in a C-array, i.e. the last index changes first.

idxIntContent :: IDXData -> Vector Int Source #

Return contained ints, if no ints are contained, convert content to ints by using round. Data is stored like in a C-array, i.e. the last index changes first.

Labeled data

labeledIntData :: IDXLabels -> IDXData -> Maybe [(Int, Vector Int)] Source #

Partition a dataset and label each subpartition, return int values

labeledDoubleData :: IDXLabels -> IDXData -> Maybe [(Int, Vector Double)] Source #

Partition a dataset and label each subpartition, return double values

IO / Serialization

IDXLabels

ByteString serialization

FileIO

encodeIDXLabelsFile :: IDXLabels -> FilePath -> IO () Source #

Read data from a file, return Nothing if something doesn't work

decodeIDXLabelsFile :: FilePath -> IO (Maybe IDXLabels) Source #

Read labels from a file, return Nothing if something doesn't work

IDXData (e.g. images)

ByteString serialization

File IO