{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : HFANN -- Copyright : (c) Olivier Boudry 2008 -- License : BSD-style (see the file LICENSE) -- -- Maintainer : olivier.boudry@gmail.com -- Stability : experimental -- Portability : portable -- -- The Fast Artificial Neural Network Library (FANN) is a free open source -- neural network library written in C with support for both fully connected -- and sparsely connected networks (). -- -- HFANN is a Haskell interface to this library. -- ----------------------------------------------------------------------------- module HFANN.Data ( -- * Data Types FannType, CFannType, CFannTypePtr, ActivationFunction, TrainAlgorithm, Fann (..), FannPtr, TrainData (..), TrainDataPtr, -- * Activation Functions fannLinear, fannThreshold, fannThresholdSymetric, fannSigmoid, fannSigmoidStepwise, fannSigmoidSymetric, fannSigmoidSymetricStepwise, fannGaussian, fannGaussianSymetric, fannGaussianStepwise, fannElliot, fannElliotSymetric, fannLinearPiece, fannLinearPieceSymetric, -- * Training Algorithms fannTrainIncremental, fannTrainBatch, fannTrainRPROP, fannTrainQuickProp ) where import Data.Word import Foreign (Ptr) import Foreign.C.Types #include -- | The Haskell input/output type -- -- This is the data type used in Haskell to represent the input/output data. -- type FannType = Double -- |The C input/output type -- This is the data type used in the C library to represent the input/output -- data. -- type CFannType = CDouble -- | A pointer to the C input/output type -- type CFannTypePtr = Ptr CDouble -- | The ANN structure -- data Fann = Fann -- | A pointer to an ANN structure -- type FannPtr = Ptr Fann -- | Data type of the training data structure -- data TrainData = TrainData -- | A pointer to the training data structure type -- type TrainDataPtr = Ptr TrainData -- | The type of the @Training Algorithm@ enumeration -- type TrainAlgorithm = #{type enum fann_train_enum} #{enum TrainAlgorithm, ,fannTrainIncremental = FANN_TRAIN_INCREMENTAL ,fannTrainBatch = FANN_TRAIN_BATCH ,fannTrainRPROP = FANN_TRAIN_RPROP ,fannTrainQuickProp = FANN_TRAIN_QUICKPROP } -- | The type of the @Activation Function@ enumeration -- type ActivationFunction = #{type enum fann_activationfunc_enum} #{enum ActivationFunction, , fannLinear = FANN_LINEAR , fannThreshold = FANN_THRESHOLD , fannThresholdSymetric = FANN_THRESHOLD_SYMMETRIC , fannSigmoid = FANN_SIGMOID , fannSigmoidStepwise = FANN_SIGMOID_STEPWISE , fannSigmoidSymetric = FANN_SIGMOID_SYMMETRIC , fannSigmoidSymetricStepwise = FANN_SIGMOID_SYMMETRIC_STEPWISE , fannGaussian = FANN_GAUSSIAN , fannGaussianSymetric = FANN_GAUSSIAN_SYMMETRIC , fannGaussianStepwise = FANN_GAUSSIAN_STEPWISE , fannElliot = FANN_ELLIOT , fannElliotSymetric = FANN_ELLIOT_SYMMETRIC , fannLinearPiece = FANN_LINEAR_PIECE , fannLinearPieceSymetric = FANN_LINEAR_PIECE_SYMMETRIC }