Questions tagged [loss-function]

If Y_pred is very far off from Y, the Loss value will be very high. However, if both values are almost similar, the Loss value will be very low. Hence we need to keep a loss function which can penalize a model effectively while it is training on a dataset. When a neural network is trying to predict a discrete value, we can consider it to be a classification model. This could be a network trying to predict what kind of animal is present in an image, or whether an email is a spam or not.

1727 questions
0
votes
1 answer

Turn a loss function into an accuracy function

I have the RMSE loss, defined as : RMSE = np.sum(np.sqrt((np.array(pred_df.real_values) - np.array(pred_df.estimate_values))**2)) where the real values and predictions are between 0.0 and 5.0 . I want to use this as an accuracy metric, not as a…
Qubix
  • 4,161
  • 7
  • 36
  • 73
0
votes
1 answer

Meaning of Loss function in Keras?

i made a neural network with keras in python and cannot really understand what the loss function means. So here first some general information: i worked with the poker hand dataset with classes 0-9, which i wrote as vectors with the OneHotEncoding.…
Eli Hektor
  • 79
  • 9
0
votes
1 answer

Translate numpy to tensor (keras) (loss function)

I'm trying to define a loss function on the following shape: (NUM_OF_STROKES, STROKE_LEN, 2) For example, let say NUM_OF_STROKES=1, STROKE_LEN=4, it can be like: [[[x1,y1], [x2,y2], [x3,y3], [x4,y4]]] I want that my loss function will be the…
Shahar182
  • 7
  • 2
0
votes
2 answers

Loss on dev set is always increasing unlike training set loss

I designed a network for a text classification problem. To do this, I'm using huggingface transformet's BERT model with a linear layer above that for fine-tuning. My problem is that the loss on the training set is decreasing which is fine, but when…
0
votes
0 answers

custom loss tensorflow with treshold on tensor

In a custom loss with tensorflow I am trying to select only the value of the true tensor and predict, between 0.2 and 0.8 and put equal to 1 other wise equal to 0. Then I calculate the mse between predict and true. def customLoss(yTrue, yPred): …
Radhook
  • 9
  • 2
0
votes
0 answers

Train Neural Network with custom loss-function

i have problems to train my neural network with a custom loss-function. The loss-function i want to use is the following MSE, which consists of MSE_y and MSE_f: It should be pointed out that the number N_f > N_y. So i want to compute predictions…
0
votes
1 answer

Visualizing custom loss in double-head model

Using an A2C agent from this article, how to get numerical values of value_loss, policy_loss and entropy_loss when weights are being updated? The model I'm using is double-headed, both heads share the same trunk. The policy head output shape is…
0
votes
1 answer

What does it mean for the loss in Keras to be different by orders of magnitude between models?

For context, I trained two separate autoencoders in Keras: one with a standard MSE loss function and one with a customized MSE loss function. When evaluating both models at a given point in training, they have very similar performance but the losses…
WVJoe
  • 515
  • 7
  • 21
0
votes
1 answer

Learning rate too large, how does this affect the loss function for logistic regression using batch gradient descent

Question: If the learning rate (a) is too large, what happens to the graph and how could this affect the loss function with iterations I've read somewhere that the graph may not converge or there could be many fluctuations in the graph, I would just…
0
votes
2 answers

Gradient Descent with Tanh, 0 gradient on incorrect classification?

The derivative of the tanh(x) activation function is 1-tanh^2(x). When performing gradient descent on this function, this derivative becomes part of the gradients for the weights. For example, with Mean Squared Error: dL/dw = (tanh(x) - y)*(1 -…
0
votes
1 answer

Regression problem where predicted value must be a whole number

I am working on a regression problem where the predicted value must be a positive integer. One approach could be to just train a model, make predictions, and round the predicted values. However, I want to try a different approach of modifying the…
user2202866
  • 91
  • 6
  • 14
0
votes
1 answer

Regression using MXNet

I have a regression model based on various independent features which eventually predict a value with a custom loss function. Somewhat similar to the link…
0
votes
1 answer

Keras Loss function using outputs of batch

I'm trying to learn a joint embedded representation of images and text using a two-branch neural network using keras. This is how my model looks like: These are the current in- and outputs of my training model: model = Model([txt_input,img_input],…
0
votes
1 answer

CNN with CTC loss

I want to extract features using a pretrained CNN model(ResNet50, VGG, etc) and use the features with a CTC loss function. I want to build it as a text recognition model. Anyone on how can i achieve this ?
0
votes
0 answers

What is the reason that makes loss function and metric have different results although the same function is used in both during training?

I am building a deep learning model as such: tf.keras.backend.clear_session() model = tf.keras.models.Sequential([ tf.keras.layers.InputLayer(input_shape=(None,30), dtype=tf.float64, ragged=True), tf.keras.layers.SimpleRNN(20,…
Arwen
  • 168
  • 1
  • 13