# darch

##### Deep architectures in R

The darch-package implements Deep-Architecture-Networks and Restricted-Bolzmann-Machines.

- Keywords
- package, gradient, neural, networks, Architectures, Backpropagation, Bolzmann, Conjugate, Contrastive, Deep, Deep-Belief-Networks, Divergence, Machines, NN, Nets, Resilient, Restricted, darch

##### Details

The creation of this package is motivated by the papers from G. Hinton et. al. from 2006 (see references for details) and from the matlab source code developed in this context. This package provides the possibility to generate deep architecture networks (darch) like the deep belief networks from Hinton et. al.. The deep architectures can then be trained with the contrastive divergence method. After this pre-training it can be fine tuned with several lerning methods like backpropagation, resilient backpropagtion and conjugate gradients.

##### References

Hinton, G. E., S. Osindero, Y. W. Teh, A fast learning algorithm for deep belief nets, Neural Computation 18(7), S. 1527-1554, DOI: 10.1162/neco.2006.18.7.1527 2006.

Hinton, G. E., R. R. Salakhutdinov, Reducing the dimensionality of data with neural networks, Science 313(5786), S. 504-507, DOI: 10.1126/science.1127647, 2006.

##### Examples

```
# Generating the datasets
inputs <- matrix(c(0,0,0,1,1,0,1,1),ncol=2,byrow=TRUE)
outputs <- matrix(c(0,1,1,0),nrow=4)
# Generating the darch
darch <- newDArch(c(2,4,1),batchSize=2)
# Pre-Train the darch
darch <- preTrainDArch(darch,inputs,maxEpoch=1000)
# Prepare the layers for backpropagation training for
# backpropagation training the layer functions must be
# set to the unit functions which calculates the also
# derivatives of the function result.
layers <- getLayers(darch)
for(i in length(layers):1){
layers[[i]][[2]] <- sigmoidUnitDerivative
}
setLayers(darch) <- layers
rm(layers)
# Setting and running the Fine-Tune function
setFineTuneFunction(darch) <- backpropagation
darch <- fineTuneDArch(darch,inputs,outputs,maxEpoch=1000)
# Running the darch
darch <- darch <- getExecuteFunction(darch)(darch,inputs)
outputs <- getExecOutputs(darch)
cat(outputs[[length(outputs)]])
```

*Documentation reproduced from package darch, version 0.9.1, License: GPL-2*