27,179 questions
487
votes
14
answers
285k
views
Epoch vs Iteration when training neural networks [closed]
What is the difference between epoch and iteration when training a multi-layer perceptron?
470
votes
10
answers
321k
views
What is the meaning of the word logits in TensorFlow? [duplicate]
In the following TensorFlow function, we must feed the activation of artificial neurons in the final layer. That I understand. But I don't understand why it is called logits? Isn't that a mathematical ...
446
votes
16
answers
448k
views
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool.
...
435
votes
3
answers
382k
views
Keras input explanation: input_shape, units, batch_size, dim, etc
For any Keras layer (Layer class), can someone explain how to understand the difference between input_shape, units, dim, etc.?
For example the doc says units specify the output shape of a layer.
...
409
votes
4
answers
89k
views
Understanding Keras Long Short Term Memories (LSTMs) [closed]
While trying to reconcile my understanding of LSTMs pointed out here in this post by Christopher Olah implemented in Keras and following the blog written by Jason Brownlee for the Keras tutorial, I am ...
401
votes
11
answers
469k
views
How do I save a trained model in PyTorch?
How do I save a trained model in PyTorch? I have read that:
torch.save()/torch.load() is for saving/loading a serializable object.
model.state_dict()/model.load_state_dict() is for saving/loading ...
387
votes
9
answers
324k
views
Why do we need to call zero_grad() in PyTorch?
Why does zero_grad() need to be called during training?
| zero_grad(self)
| Sets gradients of all model parameters to zero.
358
votes
11
answers
503k
views
How do I print the model summary in PyTorch?
How do I print the summary of a model in PyTorch like what model.summary() does in Keras:
Model Summary:
...
303
votes
6
answers
369k
views
What does model.eval() do in pytorch?
When should I use .eval()? I understand it is supposed to allow me to "evaluate my model". How do I turn it back off for training?
Example training code using .eval().
282
votes
11
answers
527k
views
How do I initialize weights in PyTorch?
How do I initialize weights and biases of a network (via e.g. He or Xavier initialization)?
279
votes
3
answers
309k
views
How to interpret loss and accuracy for a machine learning model [closed]
When I trained my neural network with Theano or Tensorflow, they will report a variable called "loss" per epoch.
How should I interpret this variable? Higher loss is better or worse, or what does it ...
241
votes
6
answers
278k
views
What does model.train() do in PyTorch?
Does it call forward() in nn.Module? I thought when we call the model, forward method is being used.
Why do we need to specify train()?
235
votes
13
answers
327k
views
Keras, How to get the output of each layer?
I have trained a binary classification model with CNN, and here is my code
model = Sequential()
model.add(Convolution2D(nb_filters, kernel_size[0], kernel_size[1],
border_mode=...
221
votes
12
answers
257k
views
Why binary_crossentropy and categorical_crossentropy give different performances for the same problem?
I'm trying to train a CNN to categorize text by topic. When I use binary cross-entropy I get ~80% accuracy, with categorical cross-entropy I get ~50% accuracy.
I don't understand why this is. It's a ...
214
votes
10
answers
190k
views
What is the difference between steps and epochs in TensorFlow?
In most of the models, there is a steps parameter indicating the number of steps to run over data. But yet I see in most practical usage, we also execute the fit function N epochs.
What is the ...