All Questions
8 questions
1
vote
1
answer
80
views
analyze the train-validation accuracy learning curve
I am building a two-layer neural network from scratch on the Fashion MNIST dataset. In between, using the RELU as activation and on the last layer, I am using softmax cross entropy. I am getting the ...
0
votes
1
answer
214
views
Average cross entropy for 3D tensors
I have an output tensor (both target and predicted) of dimension (32 x 8 x 5000). Here, the batch size is 32, the number of classes is 5000 and the number of points per batch is 8. I want to calculate ...
1
vote
1
answer
92
views
Numpy array indexing with complete vector
What does the following code do? (grad[range(m),y] -= 1)
def delta_cross_entropy(X,y):
"""
X is the output from fully connected layer (num_examples x num_classes)
y is ...
2
votes
1
answer
744
views
Pytorch LSTM and cross entropy
I am working on sentiment analysis, I want to classify the output into 4 classes. For loss I am using cross-entropy.
The problem is PyTorch cross-entropy needs the input of (batch_size, output) which ...
1
vote
1
answer
801
views
Intuition behind categorical cross entropy
I'm trying to make categorical cross entropy loss function to better understand intuition behind it.
So far my implementation looks like this:
# Observations
y_true = np.array([[0, 1, 0], [0, 0, 1]])
...
0
votes
2
answers
152
views
CNN algorithm predicts value of 1.0 and thus the cross-entropy cost function gives a divide by zero warning
I am using CNN to do binary classification.
While the cross-entropy function is calculated by the code:
(-1 / m) * np.sum(np.multiply(Y, np.log(AL)) + np.multiply(1 - Y, np.log(1 - AL)))
when the ...
1
vote
2
answers
2k
views
MemoryError when calling to_categorical in keras
I try to run the language modeling program. When I use the data train with 15000 sentences in a document, the program running properly. But, when I try to change the data with the bigger one (10 times ...
31
votes
3
answers
104k
views
python - invalid value encountered in log
I have the following expression:
log = np.sum(np.nan_to_num(-y*np.log(a+ 1e-7)-(1-y)*np.log(1-a+ 1e-7)))
it is giving me the following warning:
RuntimeWarning: invalid value encountered in log
log ...