Skip to content

Neural Networks

Soumyadeep Datta edited this page Jul 19, 2016 · 10 revisions

Info

Here we describe the neural network architecture used. The datasets used, the different layers used for our neural network and the overall architecture have been described in detail.

Fullset

fullset = {
  data : DoubleTensor - size: 40134x15x15
  size : 40121
  label : DoubleTensor - size: 40134
}

Shuffled Fullset


shuffle = torch.randperm(fullset.size)
shuffleset = fullset
for i=1, fullset.size do
    shuffleset.data[i] = fullset.data[shuffle[i]]
    shuffleset.label[i] = fullset.label[shuffle[i]]
    end
fullset = shuffleset

Trainset

trainset = {
    size = 32000,
    data = fullset.data[{{1,32000}}]:double(),
    label = fullset.label[{{1,32000}}]
}

Model

model = nn.Sequential()
model:add(nn.Reshape(225))
model:add(nn.Linear(225,700))
model:add(nn.Tanh())
model:add(nn.Linear(700,36))
model:add(nn.LogSoftMax())

nn.Sequential()

Sequential provides a means to plug layers together in a feed-forward fully connected manner.

model = nn.Sequential()

nn.Linear()

Applies a linear transformation to the incoming data, i.e. y = Ax + b.

model = nn.Linear(inputDimension, outputDimension)

nn.Tanh()

Tanh is defined as f(x) = (exp(x)-exp(-x))/(exp(x)+exp(-x)).

nn.LogSoftMax() LogSoftmax is defined as f_i(x) = log(1/a exp(x_i)), where a = sum_j exp(x_j).

The classes nn Criterions are used to compute the gradient according of a given loss function given an input and a target.

ClassNLLCriterion The negative log likelihood criterion.

Clone this wiki locally