# Tag Info

0

the soultion is simple , just pass X,Y into thse individual layers and operate as normal here is an example class mymodel(Model): def __init__(self,chandim=-1): #just an example super(mymodel, self).__init__() self.gdn1 = Dense(128 * 16 * 16, activation='relu') self.gbn1 = BatchNormalization(momentum=0.9) self.glr1 ...

0

One option is to use standard framing as learning to rank the relative positions, thus pairwise loss function.

1

As you can see in lines 286-296 in newmodels.py the model can use two different loss functions for the four different outputs. loss = {'pred1':lossfxn, 'pred2':lossfxn, 'pred3':lossfxn, 'final': losses.tversky_loss} loss_weights = {'pred1':1, 'pred2':1, 'pred3':1, 'final':1} model....

1

I think your understanding of the output vector is not correct (Not just for Neural Network but any Model) We don't encode the output to reduce the dimension. Output has not much contribution on the RAM and computation, it's the input size and dimension. Simple OHE Or just the label encoding will work(Loss function will change as per the case) What you ...

0

SparseCategoricalCrossentropy is a class while sparse_categorical_crossentropy is a function. SparseCategoricalCrossentropy -> You create an instance of this class and then pass the true values and predicted values. sparse_categorical_crossentropy -> You pass the true and predicted values just as you would do with any other function.

4

SparseCategoricalCrossentropy is a class. So you have to define a object first then you can compute the loss using it. scce = tf.keras.losses.SparseCategoricalCrossentropy() scce(y_true, y_pred).numpy() While sparse_categorical_crossentropy is merely a function which can be directly used to compute cost. loss = tf.keras.losses....

1

Have you looked into focal loss? The idea seems to be similar to what you are describing - If predictions (~0.8) is close to GT Label of 1, it does not add to the loss value.

1

In the simple example you’ve given, the outcome should be similar. Not the same because default Keras batch size is 32 and whereas in the first formulation that would mean 32 usable training examples, in the second the model could only benefit from the percentage of the 32 that you allow the loss function to see. I would prefer the first option where the ...

1

1.Technically they are the same.They will compute the same loss. Although there will be a subtle difference in performance. In the first case gradient will only be calculated for the subset but in the second case gradient will be calculated for the whole training set but only the gradient of subset will be used to compute cost and update. 2.No, the points ...

1

Your reasoning sounds similar to curriculum learning: the idea is to pass training data to the network not randomly, but based on some scoring function $f$. It was proven that a network learns faster and better, even though the process itself is not well understood. I think it is a better approach than the one you suggested: I am afraid that, if you pass ...

Top 50 recent answers are included