-
Notifications
You must be signed in to change notification settings - Fork 9
Neural Networks
Soumyadeep Datta edited this page Jul 19, 2016
·
10 revisions
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 = {
data : DoubleTensor - size: 40134x15x15
size : 40121
label : DoubleTensor - size: 40134
}
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 = {
size = 32000,
data = fullset.data[{{1,32000}}]:double(),
label = fullset.label[{{1,32000}}]
}
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())
Sequential provides a means to plug layers together in a feed-forward fully connected manner.
model = nn.Sequential()
Applies a linear transformation to the incoming data, i.e. y = Ax + b.
model = nn.Linear(inputDimension, outputDimension)
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.