text
stringlengths
81
47k
source
stringlengths
59
147
Question: <p>I came across the hinge loss function for training a neural network model, but I did not know the analytical form for the same.</p> <p>I can write the mean squared error loss function (which is more often used for regression) as</p> <p><span class="math-container">$$\sum\limits_{i=1}^{N}(y_i - \hat{y_i})^2...
https://ai.stackexchange.com/questions/26330/what-is-the-definition-of-the-hinge-loss-function
Question: <p>In this <a href="https://www.deeplearning.ai/ai-notes/optimization/" rel="nofollow noreferrer">AI note</a> from <a href="https://deeplearning.ai" rel="nofollow noreferrer">https://deeplearning.ai</a>, the loss function below is used for a regression problem. However, I don't know how to interpret this loss...
https://ai.stackexchange.com/questions/36709/how-do-i-interpret-this-loss-function
Question: <p>For imbalanced datasets (either in the context of computer vision or NLP), from what I learned, it is good to use a weighted log loss. However, in competitions, the people who are in top positions are not using weighted loss functions, but treating the classification problem as a regression problem, and us...
https://ai.stackexchange.com/questions/23653/which-loss-function-to-choose-for-imbalanced-datasets
Question: <p>I've been studying NNs with tensorflow and decided to code a simple NN from scratch to get a better idea on hwo they work.</p> <p>It my understanding that the cost is used in backpropagation, so basically you calculate the error between prediction and actual and backpropagate from there.</p> <p>However, in...
https://ai.stackexchange.com/questions/38905/what-is-loss-function-in-neural-networks
Question: <p>We need to use a loss function for training the neural networks.</p> <p>In general, the loss function depends only on the desired output <span class="math-container">$y$</span> and actual output <span class="math-container">$\hat{y}$</span> and is represented as <span class="math-container">$L(y, \hat{y})$...
https://ai.stackexchange.com/questions/28855/does-regularization-just-mean-using-an-augmented-loss-function
Question: <p>I was trying to implement the loss function of <a href="https://yanweifu.github.io/papers/hairstyle_v_14_weidong.pdf" rel="nofollow noreferrer">H-GAN</a>. Here is my <a href="http://codepad.org/9C3Vac25" rel="nofollow noreferrer">code </a>. But it seem somethings wrong, maybe is recognition loss on z (EQ ...
https://ai.stackexchange.com/questions/16101/how-to-implement-loss-function-of-h-gan-model
Question: <p>I have a binary classification problem, where there are multiple correct predictions, however, I would consider the prediction to be correct if the highest confidence prediction of a 1 is correct.</p> <p>I have had limited success with a CNN using the Hinge loss function. I think the reason is that, this l...
https://ai.stackexchange.com/questions/37453/loss-function-for-binary-classification-with-multiple-correct-choices
Question: <p>Loss functions are useful in calculating loss and then we can update the weights of a neural network. The loss function is thus useful in training neural networks.</p> <p>Consider the following excerpt from <a href="https://ai.stackexchange.com/questions/28877/what-are-the-necessary-mathematical-properties...
https://ai.stackexchange.com/questions/29963/how-to-check-whether-my-loss-function-is-convex-or-not
Question: <p>I am trying make an ANN model that takes a constant m (will be changed later but now it is just a constant, let's say 0) as an input and generate 5 non-integer numbers (a1,a2..a5) after some layers like relu, linear,relu ... and then these 5 numbers enter to the loss function layer along with an additional...
https://ai.stackexchange.com/questions/17473/generating-5-numbers-with-1-input-before-loss-function
Question: <p>What loss function is most appropriate when training a model with target values that are probabilities? For example, I have a 3-output model. I want to train it with a feature vector <span class="math-container">$x=[x_1, x_2, \dots, x_N]$</span> and a target <span class="math-container">$y=[0.2, 0.3, 0.5]$...
https://ai.stackexchange.com/questions/11816/what-loss-function-to-use-when-labels-are-probabilities
Question: <p>Loss_Function/Maximize_Function/Score_Function, CustomLoss, pytorch. Using Custom Loss for Maximizing Score in PyTorch</p> <p>I'm using a PyTorch model with an LSTM input layer, a linear hidden layer, and 3 neurons in the output layer with a softmax activation function.</p> <p>Instead of using a loss funct...
https://ai.stackexchange.com/questions/41933/how-to-transform-a-loss-function-into-a-score-function
Question: <p>Recently I developed a custom training algorithm for deep learning models, based on evolutionary algorithms. Details are not important, except that it also uses decreasing regular cross entropy loss as its fitness function.</p> <p>What I observed is that it very well decreases the loss function but the cla...
https://ai.stackexchange.com/questions/37176/what-loss-function-will-be-correlated-with-classification-metrics
Question: <p>I have a Deep Feedforward Neural Network <span class="math-container">$F: W \times \mathbb{R}^d \rightarrow \mathbb{R}^k$</span> (where <span class="math-container">$W$</span> is the space of the weights) with <span class="math-container">$L$</span> hidden layers, <span class="math-container">$m$</span> ne...
https://ai.stackexchange.com/questions/10025/comparing-and-studying-loss-functions
Question: <p>I'm training a Tensorflow model that receives an image and segments the image into foreground and background. That is, if the input image is <code>w x h x 3</code>, then the neural network outputs a <code>w x h x 1</code> image of <code>0</code>'s and <code>1</code>'s, where <code>0</code> represents backg...
https://ai.stackexchange.com/questions/33924/custom-tensorflow-loss-function-that-disincentivizes-all-black-pixels
Question: <p>I have two convex, smooth loss functions to minimise. During the training (a very simple model) using batch SGD (with tuned optimal learning rate for each loss function), I observe that the (log) loss curve of the loss 2 converges much faster and is much more smooth than that of the loss 2, as shown in the...
https://ai.stackexchange.com/questions/17376/deduce-properties-of-the-loss-functions-from-the-training-loss-curves
Question: <p>I am looking at a problem which can be distilled as follows: I have a phenomenon which can be modeled as a probability density function which is "messy" in that it sums to unity over its support but is somewhat jagged and spiky, and does not correspond to any particular textbook function. It takes consid...
https://ai.stackexchange.com/questions/13251/which-loss-functions-for-transforming-a-density-function-to-another-density-func
Question: <p>I am training Deep Learning models to predict the Remaining Useful Life (RUL) of certain devices. The RUL is an estimate of the time remaining until the device is expected to fail. Accurate predictions are especially critical when the RUL is low, as you have little time of reaction to plan maintenance or m...
https://ai.stackexchange.com/questions/47698/loss-function-that-penalizes-errors-more-at-low-values
Question: <p>I am working on a segmentation of MRI images of the thigh. I am trying to segment the fascia, there is a slight imbalance between the background and the mask. I have about 1400 images from 30 patients for training and 200 for validation. I am working with keras. The loss function is combination of weighted...
https://ai.stackexchange.com/questions/24674/loss-function-decays-linearly-in-segmentation-mri-fascia
Question: <p>I have a rather large ML framework that takes multiple conditional probability terms that are computed via classifiers/neural networks. This arbitrary loss function is computed via a function:</p> <pre><code>loss_value = arbitrary_loss(probability1, probability2, ..., P(Y|Z)) </code></pre> <p>I wish to hav...
https://ai.stackexchange.com/questions/46182/using-conditional-probability-as-an-estimate-in-a-loss-function
Question: <p>I am reading article <a href="https://allenai.org/paper-appendix/emnlp2017-wt/" rel="nofollow noreferrer">https://allenai.org/paper-appendix/emnlp2017-wt/</a> <a href="http://ai2-website.s3.amazonaws.com/publications/wikitables.pdf" rel="nofollow noreferrer">http://ai2-website.s3.amazonaws.com/publications...
https://ai.stackexchange.com/questions/8487/how-to-understand-marginal-loglikelihood-objective-function-as-loss-function-ex
Question: <p>I am training a deep learning model, the loss function of which is of the form</p> <p><span class="math-container">$$ \cal{L} = \cal{L_1} + \cal{L_2} $$</span></p> <p>where <span class="math-container">$\cal{L_1}$</span> and <span class="math-container">$\cal{L_2}$</span> are of very different orders. WLOG...
https://ai.stackexchange.com/questions/43522/impact-of-scaling-in-loss-terms-when-loss-function-is-a-composition-of-multiple
Question: <p>I'm trying to train a neural net to choose a subset from some list of objects. The input is a list of objects <span class="math-container">$(a,b,c,d,e,f)$</span> and for each list of objects the label is a list composed of 0/1 - 1 for every object that is in the subset, for example <span class="math-conta...
https://ai.stackexchange.com/questions/20531/loss-function-for-choosing-a-subset-of-objects
Question: <p>How do I interpret a large variance of a loss function?</p> <p>I am currently training a transformer network (using the software, but not the model from GPT-2) from scratch and my loss function looks like this: <a href="https://i.sstatic.net/LvhRs.png" rel="nofollow noreferrer"><img src="https://i.sstatic...
https://ai.stackexchange.com/questions/13862/how-to-interpret-a-large-variance-of-the-loss-function
Question: <p>I am studying logistic regression for binary classification.</p> <p>The loss function used is <strong>cross-entropy</strong>. For a given input <span class="math-container">$x$</span>, if our model outputs <span class="math-container">$\hat{y}$</span> instead of <span class="math-container">$y$</span>, the...
https://ai.stackexchange.com/questions/28288/in-logistic-regression-why-is-the-binary-cross-entropy-loss-function-convex
Question: <p>I want to use deep learning to estimate the value of a function based on some data. However, the loss function would be neither convex nor concave. Can I know if it is a big deal in deep learning? Is training a deep network, when loss function is convex, the same as optimizing a convex problem or not? I wo...
https://ai.stackexchange.com/questions/4271/non-convex-loss-function-in-deep-learning-is-a-big-deal
Question: <p>With reference to the research paper entitled <a href="https://ieeexplore.ieee.org/document/7296633" rel="nofollow noreferrer">Sentiment Embeddings with Applications to Sentiment Analysis</a>, I am trying to implement its sentiment ranking model in Python, for which I am required to optimize the following ...
https://ai.stackexchange.com/questions/8281/how-do-i-calculate-the-gradient-of-the-hinge-loss-function
Question: <p>Suppose I have an image segmentation model with an output of <code>[ 128, 128, 2 ]</code>, segmenting an input image into 2 parts.</p> <p>Commonly, loss functions have the sigmoid or softmax needed to produce a probability distribution in the loss function itself, for example:</p> <pre><code>tf.nn.sigmoid_...
https://ai.stackexchange.com/questions/39648/should-softmax-be-in-the-model-or-in-the-loss-function
Question: <p>I plan to create a neural network using Python, Keras, and TensorFlow. All the tutorials I have seen so far are concerned with image recognition. However, the goal of my program would be to take in 10+ inputs and calculate a binary output (true/false) instead.</p> <p>Which loss function should I use for my...
https://ai.stackexchange.com/questions/13256/which-loss-function-should-i-use-for-binary-classification
Question: <p>In Deep Q Learning algorithm the convergence is generally achieved using smart tricks like the target network and the replay buffer.</p> <p>However there is one thing which is not clear to me. When the Q network is trained through SGD, the loss function is an expectation over all possible states, which is ...
https://ai.stackexchange.com/questions/42239/dqn-loss-function-doubt-about-stochastic-approximation
Question: <p>I'm having the following problem: `</p> <p>I'm training a multi-output CNN and using the relative values of the outputs in my loss function. The net is learning well, but as the absolute values of the outputs are not regularized in anyway in the loss function, the values of the outputs keep rising. This c...
https://ai.stackexchange.com/questions/4398/constraining-the-output-value-range-of-a-cnn-independent-of-the-loss-function
Question: <p>I'm using a neural network to solve a multi regression problem because I'm trying to predict continuous values. To be more specific, I'm making a tracking algorithm to track the position of an object, I'm trying to predict two values, the latitude and longitude of an object.</p> <p>Now, to calculate the lo...
https://ai.stackexchange.com/questions/16022/when-should-i-create-a-custom-loss-function
Question: <p>I am trying to predict noise (random gaussian) with the help of a neural network. I am implementing a L2 loss (torch.nn.function.mse_loss) for computing the loss function between the prediction distribution and input distribution (random gaussian). Any suggestions on what I may do to correct this?</p> <p><...
https://ai.stackexchange.com/questions/40482/loss-function-not-able-to-capture-the-maxima-of-probability-distribution
Question: <p>I'm trying to get my toy network to learn a sine wave.</p> <p>I output (via tanh) a number between -1 and 1, and I want the network to minimise the following loss, where <code>self(x)</code> are the predictions.</p> <pre><code>loss = -torch.mean(self(x)*y) </code></pre> <p>This should be equivalent to trad...
https://ai.stackexchange.com/questions/35850/what-should-i-think-about-when-designing-a-custom-loss-function
Question: <p>Loss functions are used in training neural networks.</p> <p>I am interested in knowing the mathematical properties that are necessary for a loss function to <strong>participate in gradient descent optimization</strong>.</p> <p>I know some <em>possible</em> candidates that may decide whether a function can ...
https://ai.stackexchange.com/questions/28877/what-are-the-necessary-mathematical-properties-to-be-a-loss-function-in-gradient
Question: <p>The purpose of training neural networks is to minimize a loss function, in this process we usually use gradient descent method.</p> <p>But in Calculus, if we want to find the global minimum of a multivariable function, we usually first calculate the partial derivatives of this function with respect to its ...
https://ai.stackexchange.com/questions/36195/why-do-we-use-gradient-descent-to-minimize-the-loss-function
Question: <p>I have a multi label classification problem, where I was initially using a binary cross entropy loss and my labels are one hot encoded. I found a paper similar to my application and have used contrastive loss function, but I am not sure how to use it in my code. I came across an implementation of supervise...
https://ai.stackexchange.com/questions/48047/how-to-use-contrastive-loss-function-for-multi-label-classification
Question: <p>I trained a neural network on the <a href="https://www.unsw.adfa.edu.au/unsw-canberra-cyber/cybersecurity/ADFA-NB15-Datasets/" rel="nofollow noreferrer">UNSW-NB15 dataset</a>, but, during training, I am getting spikes in the loss function. The algorithms see part of this UNSW dataset a single time. The los...
https://ai.stackexchange.com/questions/10764/why-am-i-getting-spikes-in-the-values-of-the-loss-function-during-training
Question: <p>I am trying to build an autoencoder for semi-supervised anomaly detection on an intrusion detection dataset (CICIDS2017). The dataset has data with very wide range (like between 0 and 1+08).</p> <p>I am struggling with choosing a combination of scaler, final layer activation function, and loss function.</p...
https://ai.stackexchange.com/questions/47443/autoencoder-for-semi-supervised-anomaly-detection-a-choice-of-loss-function-s
Question: <p>I implemented a parallel backpropagation algorithm that uses <span class="math-container">$n$</span> threads. Now every thread gets <span class="math-container">$\dfrac{1}{n}$</span> examples of the training data and updates its instance of the net with it. After every epoch the different threads share the...
https://ai.stackexchange.com/questions/30418/parallelize-backpropagation-how-to-synchronize-the-weights-of-each-thread
Question: <p>Assume the gradient updates (both <span class="math-container">$W_t$</span> and <span class="math-container">$W_{t+1}$</span>) and learning rate are known while data <span class="math-container">$X$</span> is unknown, is it possible to deduce the loss <span class="math-container">$L$</span> used in backpro...
https://ai.stackexchange.com/questions/38308/is-it-possible-to-reverse-engineer-out-the-loss-based-on-weights-update-when-dat
Question: <p>I have a neural network that is being trained with a changing cost function. Could I use backpropagation at all? If yes, how would I do this?</p> Answer: <p>There is nothing wrong with changing your cost/loss function after every step while training a neural network. For example, this paper looks at a wei...
https://ai.stackexchange.com/questions/40059/how-would-i-use-backpropagation-with-a-changing-cost-function
Question: <p>I am reading about backpropagation for fully connected neural networks and I found a very interesting <a href="https://www.jeremyjordan.me/neural-networks-training/" rel="nofollow noreferrer">article</a> by Jeremy Jordan. It explains the process from start to finish. There is a section though that confused...
https://ai.stackexchange.com/questions/37968/back-propagation-activation-function-derivative
Question: <p>I'm trying to study how backpropagation works step by step in a MultiLayer Perceptron neural network. I would really like to be able to understand how these calculations work. And I have a specific question I would like to ask. The formulas <strong>I'm trying to learn are the following to calculate the ...
https://ai.stackexchange.com/questions/42447/what-is-the-backpropagation-formula-to-calculate-delta-and-update-weights
Question: <p>I'm trying to understand a line of my note.</p> <p>Let's say there is a simple feedforward neural network that has <span class="math-container">$N$</span> layers, and for a given layer <span class="math-container">$l$</span>, it has weight <span class="math-container">$W^l$</span>, and <span class="math-co...
https://ai.stackexchange.com/questions/40727/about-the-requirement-to-compute-the-gradient-at-layer-l
Question: <p>Here's a BackProp Algo definition from <a href="https://ujjwalkarn.me/2016/08/09/quick-intro-neural-networks/" rel="nofollow noreferrer">here</a>:</p> <blockquote> <p>Initially all the edge weights are randomly assigned. For every input in the training dataset, the ANN is activated and its output is observ...
https://ai.stackexchange.com/questions/46239/how-does-backprop-avoid-bias-for-the-last-input-used-for-training
Question: <p><strong>References:</strong></p> <ul> <li><strong>Chain rule in Wikipedia:</strong> <a href="https://en.wikipedia.org/wiki/Chain_rule" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Chain_rule</a></li> <li><strong>Chain rule in Towards Data Science:</strong> <a href="https://towardsdatascience.com...
https://ai.stackexchange.com/questions/42722/does-this-article-make-use-of-the-chain-rule-and-where
Question: <p>I have a question about backpropagation, I'm a beginner, I'm studying the formulas to calculate the delta of neurons, there are several sources on the internet, which teach in different ways, so I'm confused about the formulas presented in the explanations, as they are a little different. Please, could som...
https://ai.stackexchange.com/questions/42626/please-could-someone-help-me-understand-if-the-backpropagation-explanations-in
Question: <p>In section 6.5.6 of the book <a href="https://www.deeplearningbook.org" rel="nofollow noreferrer">Deep Learning</a> by Ian et. al. general backpropagation algorithm is described as:</p> <blockquote> <p>The back-propagation algorithm is very simple. To compute the gradient of some scalar z with respect to o...
https://ai.stackexchange.com/questions/22238/i-need-help-understanding-general-back-propagation-algorithm
Question: <p>I'm a bit confused about this. Assume I have a CNN network with two branches:</p> <ol> <li>Top</li> <li>Bottom</li> </ol> <p>The top branch outputs a feature vector of shape 1x1x1x10 (batch, h, w, c) The bottom branch outputs a feature vector of shape (1, 10, 10, 10).</p> <p>I want to use the top featur...
https://ai.stackexchange.com/questions/8664/using-features-extracted-from-a-cnn-as-convolutional-filter
Question: <p>There is a theorem that states that basically a neural network can approximate any function whatsoever. However, this does not mean that it can solve any equation. I have some notes where it states that backpropagation allows us to solve problems of the following kind </p> <p><span class="math-container">...
https://ai.stackexchange.com/questions/20715/class-of-functional-equations-that-backpropagation-can-solve
Question: <p>I read Yann LeCun's paper <a href="https://www.researchgate.net/publication/2811922_Efficient_BackProp" rel="nofollow noreferrer">Efficient BackProp</a>, which was published in 2000. I looked for similar but more recent papers on <a href="https://arxiv.org/" rel="nofollow noreferrer">Arxiv</a>, but I have ...
https://ai.stackexchange.com/questions/26986/are-there-relatively-new-research-papers-that-describe-how-to-make-back-propagat
Question: <p>Is a Levenberg–Marquardt algorithm a type of back-propagation algorithm or is it a different category of algorithm?</p> <p>Wikipedia says that it is a curve fitting algorithm. How is a curve fitting algorithm relevant to a neural net?</p> Answer: <p>In the context of Neural Networks, Backpropagation (wit...
https://ai.stackexchange.com/questions/2520/what-kind-of-algorithm-is-the-levenberg-marquardt-algorithm
Question: <p>I have this simple neural network in Python which I'm trying to use to aproximation tanh function. As inputs I have x - inputs to the function, and as outputs I want tanh(x) = y. I'm using sigmoid function also as an activation function of this neural network. </p> <pre><code>import numpy # scipy.special ...
https://ai.stackexchange.com/questions/18762/simple-three-layer-neural-network-with-backpropagation-is-not-approximating-tanh
Question: <p>I Build this NN in c++. I reviewed it since 3 days. I checked every line 100 times, but I cant find my error. If someone can please help me find the Bugs: 1. The output is garbage 2. The weights go from 2e^79 down to -1.8e^80 after approximatly 400 iterations.</p> <pre><code>mat flip(mat m) { mat out(...
https://ai.stackexchange.com/questions/2588/why-doesnt-my-neural-network-work
Question: <p>I have really quite hard difficulties to understand what is actually going on in the backward pass of a CNN.</p> <p>I am currently focusing on these references:</p> <ol> <li><a href="https://towardsdatascience.com/forward-and-backward-propagations-for-2d-convolutional-layers-ed970f8bf602" rel="nofollow nor...
https://ai.stackexchange.com/questions/32271/cnn-difficulties-understanding-backward-pass-derivatives
Question: <p>When it comes to CNNs, I don't understand 2 things in the training process:</p> <ol> <li><p>How do I pass the error back when there are pooling layers between the convolutional layers?</p></li> <li><p>And if I know how it's done, can I train all the layers just like layers in normal Feed Forward Neural Ne...
https://ai.stackexchange.com/questions/7527/how-to-train-a-cnn
Question: <p>My full code is as follows. I have tried to whittle it down to just the code that matters, but the problem I have is that i'm not sure what part of my network code is producing the problem. I've removed my code that loads and sifts through the CSV data because then my code would be too long.</p> <pre><cod...
https://ai.stackexchange.com/questions/15970/why-is-my-neural-network-giving-me-wildly-incorrect-error-and-not-changing-accur
Question: <p>I was wanting to add a maximum in my neural network, but this seems a bad thing to do since it kills the gradients to all but one of the inputs.</p> <p>Is there some kind of &quot;weighted maximum&quot; that allows the gradients to backpropagate?</p> <p>Edit: I had a two dimensional tensor (correlation mat...
https://ai.stackexchange.com/questions/35494/is-there-some-kind-of-weighted-maximum-that-allows-the-gradients-to-backpropag
Question: <p>I have a neural network that is composed of an input layer, two hidden layers and an output layer. The topology is [151, 200, 100, 1] I am using ReLU activation function on the neurons that are in the hidden layers and no activation function on the neuron that is in the output layer. I am wondering if when...
https://ai.stackexchange.com/questions/36594/in-a-neural-networks-neuron-that-has-no-activation-function-to-calculate-the-d
Question: <p>I am working on an implementation of the back propagation algorithm. What I have implemented so far seems working but I can't be sure that the algorithm is well implemented, here is what I have noticed during training test of my network:</p> <p>Specification of the implementation:</p> <ul> <li>A data set...
https://ai.stackexchange.com/questions/2727/how-to-test-if-my-implementation-of-back-propagation-neural-network-is-correct
Question: <p>I'm relatively new to neural networks and was wondering what an implementation of <a href="https://www.researchgate.net/profile/Bing_Zhao23/publication/271546169_Study_on_NNPID-based_adaptive_control_for_electro-optical_gyro_stabilized_platform/links/56e745f408ae438aab881bab.pdf" rel="noreferrer">this pape...
https://ai.stackexchange.com/questions/3971/what-would-an-implementation-of-this-neural-network-look-like
Question: <p>I'm wondering if I can visualize the backprop process as follows (please excuse me if I have written something terrible wrong). If the loss function <span class="math-container">$L$</span> on a neural network represents the function has the form <span class="math-container">$$L = f(g(h(\dots u(v(\dots))))...
https://ai.stackexchange.com/questions/9190/am-i-able-to-visualize-the-differentiation-in-backprop-as-follows
Question: <p>I'm developing my first neural network, using the well known MNIST database of handwritten digit. I want the NN to be able to classify a number from 0 to 9 given an image.</p> <p>My neural network consists of three layers: the input layer (784 neurons, each one for every pixel of the digit), a hidden laye...
https://ai.stackexchange.com/questions/20053/how-to-perform-back-propagation-with-different-sized-layers
Question: <p>I was reading a paper on alternatives to backpropagation as a learning algorithm in neural networks. In <a href="https://arxiv.org/pdf/1609.01596.pdf" rel="nofollow noreferrer">this paper</a>, the author talks about the disadvantages of backpropagation, and one of the disadvantages stated is that backpropa...
https://ai.stackexchange.com/questions/35449/what-do-symmetric-weights-mean-and-how-does-it-make-backpropagation-biologically
Question: <p>I recently just finished programming a neural network in c#, and it seems like it's working. My question is if I'm doing it right. It's a very confusing process so I will explain.</p> <p>Basically every neuron in the network has a bias (except the first layer) and fully connected weights to the next. every...
https://ai.stackexchange.com/questions/37297/is-my-neural-network-working
Question: <p>When an LLM creates an output, it seemingly has no way to check if its output was valid. Therefore it wouldn't be able to back-propagate any changes to the weights is used to create that output.</p> <p>Right now, I suspect that all weight modification is done by training on input data, as that can (genera...
https://ai.stackexchange.com/questions/41253/does-the-output-of-llms-affect-their-neural-weights
Question: <p>I'm currently working on constructing a neural network from scratch (in JavaScript). I'm in the middle of working on the backpropagation, but there's something I don't understand: how does the backprop algorithm know which weights to change or which paths to take? The way I did it, it always took all of th...
https://ai.stackexchange.com/questions/31945/how-does-backpropagation-know-which-weights-to-change
Question: <p><strong>What is the difference between &quot;delta&quot;, &quot;gradient&quot; and &quot;error&quot;, are these names the same thing?</strong></p> <p>I'm confused because someone once told me that both the names &quot;delta&quot; and &quot;error&quot; are commonly used. And I searched the internet, and som...
https://ai.stackexchange.com/questions/42633/in-multilayer-perceptron-neural-networks-are-the-names-delta-gradient-and
Question: <p><strong>Reference:</strong> <a href="https://home.agh.edu.pl/%7Evlsi/AI/backp_t_en/backprop.html" rel="nofollow noreferrer">https://home.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html</a></p> <p>If I trained a multilayer percetron neural network manually, following exactly the backpropagation steps described...
https://ai.stackexchange.com/questions/42776/if-i-manually-trained-a-multilayer-percetron-neural-network-always-following-ex
Question: <p><strong>Article 1:</strong> <a href="https://pyimagesearch.com/2021/05/06/backpropagation-from-scratch-with-python/" rel="nofollow noreferrer">https://pyimagesearch.com/2021/05/06/backpropagation-from-scratch-with-python/</a></p> <p><strong>Article 2:</strong> <a href="https://machinelearningmastery.com/im...
https://ai.stackexchange.com/questions/42884/why-in-one-article-to-calcule-the-delta-uses-the-weights-of-current-layer-while
Question: <p>Here's a basic GPT2 implementation:</p> <pre><code>class GPT(nn.Module): def __init__(self, vocab_size, seq_len, model_dim, n_heads, n_layers): super().__init__() self.seq_len = seq_len self.wte = nn.Embedding(vocab_size, model_dim) self.wpe = nn.Embedding(seq_len, model...
https://ai.stackexchange.com/questions/43565/can-positional-encodings-in-transformers-be-added
Question: <p>My understanding is this: When doing Stochastic Gradient Descent over a neural network, in every epoch, we run <span class="math-container">$n$</span> iterations (where the dataset has <span class="math-container">$n$</span> training examples) and in every iteration, we take a random sample and update the ...
https://ai.stackexchange.com/questions/43688/what-do-you-mean-by-updating-based-on-a-training-example-batch-in-gradient-des
Question: <p>Why are the weights of a neural net updated only considering the old values of the later layer, not the already updated values?</p> <p>I use <a href="https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/" rel="nofollow noreferrer">this example</a> to explain my problem. When applying the...
https://ai.stackexchange.com/questions/26136/why-are-the-weights-of-the-previous-layers-updated-only-considering-the-old-valu
Question: <p>I recently started working on very simple machine learning codes in Python and I came across a big problem: teaching the system to improve on its guesses.</p> <p>So this is what the code is about: I will have a list of organisms with their features stated in numerical values. I want to write a code that ...
https://ai.stackexchange.com/questions/4211/finding-an-optimum-back-propagation-algorithm
Question: <p>Implementations of variational autoencoders that I've looked at all include a sampling layer as the last layer of the encoder block. The encoder learns to generate a mean and standard deviation for each input, and samples from it to get the input's representation in latent space. The decoder then attempt...
https://ai.stackexchange.com/questions/33824/how-does-backprop-work-through-the-random-sampling-layer-in-a-variational-autoen
Question: <p>The Back propagation through time on recurrent layer is defined similar to normal one, means somethin like </p> <p><code>self.deltas[x] = self.deltas[x+1].dot(self.weights[x].T) * self.layers[x] * (1- self.layers[x])</code> where </p> <p><code>self.deltas[x+1]</code> is error from prevous layer, <code>...
https://ai.stackexchange.com/questions/12657/do-you-need-to-store-prevous-values-of-weights-and-layers-on-recurrent-layer-whi
Question: <p>I was reading the following book: <a href="http://neuralnetworksanddeeplearning.com/chap2.html" rel="nofollow noreferrer">http://neuralnetworksanddeeplearning.com/chap2.html</a></p> <p>and towards the end of equation 29, there is a paragraph that explains this: </p> <p><a href="https://i.sstatic.net/KkBd...
https://ai.stackexchange.com/questions/12682/how-does-adding-a-small-change-to-an-neurons-weighted-input-affect-the-overall
Question: <p>I am trying to wrap my head around how weights get updated during back propagation. I've been going through a school book and I have the following setup for an ANN with 1 hidden layer, a couple of inputs and a single output. </p> <p><a href="https://i.sstatic.net/fVkiR.png" rel="nofollow noreferrer"><img ...
https://ai.stackexchange.com/questions/18213/function-to-update-weights-in-back-propagation
Question: <p>We require to find the gradient of loss function(cost function) w.r.t to the weights to use optimization methods such as SGD or gradient descent. So far, I have come across two ways to compute the gradient:</p> <ol> <li>BackPropagation</li> <li>Calculating gradient of loss function by calculus</li> </ol> ...
https://ai.stackexchange.com/questions/19895/different-methods-of-calculating-gradients-of-cost-functionloss-function
Question: <p>For the purposes of this question I am asking about training the generator, assume that training the discriminator is another topic.</p> <p>My understanding of generative adversarial networks is that you feed random input data to the generator and it generates images. Out of those images, the ones which t...
https://ai.stackexchange.com/questions/10053/training-the-generator-in-a-gan-pair-with-back-propagation
Question: <p>I'm reading the paper <a href="https://arxiv.org/pdf/1806.07366.pdf" rel="nofollow noreferrer">Neural Ordinary Differential Equations</a> and I have a simple question about adjoint method. When we train NODE, it uses a blackbox ODESolver to compute gradients through model parameters, hidden states, and tim...
https://ai.stackexchange.com/questions/24040/computation-of-initial-adjoint-for-node
Question: <p>Can we create a learning algorithm that solves all the problems of backpropagation through evolution?</p> Answer: <p>What you are referring to are called evolutionary methods/genetic algorithms/zero order optimizers/many other names.</p> <p>However, it all depends on what you do with them. The core idea o...
https://ai.stackexchange.com/questions/45746/creating-a-replacement-for-backpropagation-through-evolution
Question: <p>I have an odd little problem facing me for my project.</p> <p>I have a smooth polygon defined by parameters.</p> <p>I have convolution transformation, similar to a Gaussian blur. This transformation can only be applied to an image.</p> <p>Consequently, I need to convert the polygon to an image. I then app...
https://ai.stackexchange.com/questions/46614/backpropagation-with-rasterization-step
Question: <p>A am interested in physiologic neural network. Altough there are some opposite views, most probably there seems to be no plausible way to explain a physiologic backpropagation in the brain.</p> <p>So I am trying to code a neural network without backpropagation yet my mathematical understanding is inadaqua...
https://ai.stackexchange.com/questions/34937/do-we-need-backpropagation-if-there-is-only-one-class
Question: <p>I work with a few different automatic differentiation frameworks, including pytorch, Jax, and Flux in Julia. Periodically I run some code and I get errors about mutations or operations occurring &quot;in-place.&quot; These errors generally cause the program to fail. <em>My question is, what does this error...
https://ai.stackexchange.com/questions/43760/why-does-in-place-mutation-cause-automatic-differentiation-to-fail-and-how-to
Question: <p>I will give an example of wishful thinking. When you try to prove a theorem you think what would imply that theorem and maybe try to find a lemma that implies it. Maybe neurons try to connect previous neurons that has the relevant information. I am not knowledgeable in the subject.</p> Answer: <p>The shor...
https://ai.stackexchange.com/questions/48451/do-neural-networks-do-wishful-thinking
Question: <p>Assuming that the cost function <span class="math-container">$J$</span> is the average of the loss function <span class="math-container">$\mathcal{L}$</span> over all training examples <span class="math-container">$m$</span></p> <p><span class="math-container">$J(w) = \frac{1}{m} \displaystyle\sum_{i=0}^{m...
https://ai.stackexchange.com/questions/45044/why-do-we-update-parameters-with-respect-to-cost-instead-of-loss
Question: <p>This is the back-propogation rule for the output layer of a multi-layer network:</p> <p><span class="math-container">$$W_{jk} := W_{jk} - C \dfrac{\delta E}{\delta W_{jk}}$$</span></p> <p>What does this rule do in the more ambiguous cases such as:</p> <p>(1) The output of a hidden node is near the middle o...
https://ai.stackexchange.com/questions/25500/backpropogation-rule-for-the-output-layer-of-a-multi-layer-network-what-does-t
Question: <p>We have always known that gradient descent is a function of two or more variables. But how can we geometrically represent gradient descent if it is a function of only one variable?</p> Answer: <p>For a function of one variable, there are only two options for directions in the domain: left or right, so it ...
https://ai.stackexchange.com/questions/3668/how-would-1d-gradient-descent-look-like
Question: <p>I'm trying to implement a simple neural network for classification (multi-class) as an exercise (written in C). During gradient descent, the weights and biases quickly get out of control and the gradient becomes infinite.</p> <p>I haven't been able to find any discussion of such problems (vanishing gradien...
https://ai.stackexchange.com/questions/36567/numerical-problems-with-gradient-descent
Question: <p>Andrew Ng said in his slide that: <a href="https://i.sstatic.net/ImraM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ImraM.png" alt="enter image description here" /></a> However, there are numerous types of 'learning rate schedules' in TensorFlow that change the learning rate profile as tr...
https://ai.stackexchange.com/questions/43523/why-use-learning-rate-schedules-if-weight-updates-automatically-decrease-when-ap
Question: <p>imaging input vector a = {a1,a2,a3} and z = softmax(a) = {z1,z2,z3}</p> <p>So, we expect than gradient of z with respect of a would be the same shape as vector a (so we can make gradient step: a = a - learning rate * dz/da). But the real shape is (3,3). So what should i do to make the gradient step? <a hre...
https://ai.stackexchange.com/questions/47062/softmax-gradient-for-automatic-differentiation
Question: <p>I have 10000 tuples of numbers <code>(x1, x2, y)</code> generated from the equation: <code>y = np.cos(0.583 * x1) + np.exp(0.112 * x2)</code>. I want to use a neural network, trained with gradient descent, in PyTorch, to find the 2 parameters, i.e. 0.583 and 0.112</p> <p>Here is my code:</p> <pre><code>c...
https://ai.stackexchange.com/questions/17239/how-can-i-train-a-neural-network-to-find-the-hyper-parameters-with-which-the-dat
Question: <p>The gradient descent step is the following</p> <p><span class="math-container">\begin{align} \mathbf{W}_i = \mathbf{W}_{i-1} - \alpha * \nabla L(\mathbf{W}_{i-1}) \end{align}</span></p> <p>were <span class="math-container">$L(\mathbf{W}_{i-1})$</span> is the loss value, <span class="math-container">$\alp...
https://ai.stackexchange.com/questions/17295/how-is-the-loss-value-calculated-in-order-to-compute-the-gradient
Question: <p>I found this <a href="https://ai.stackexchange.com/questions/25109/is-there-anything-that-ensures-that-convolutional-filters-dont-end-up-the-same">question</a> very interesting, and this is a follow up on it.</p> <p>Presumably, we'd want all the filters to converge towards some complementary set, where eac...
https://ai.stackexchange.com/questions/25464/is-there-anything-that-ensures-that-convolutional-filters-end-up-different-from
Question: <p>When we perform gradient descent, especially in an online setting where the training data is presented in a non-random order, a particular 1-dimensional parameter (such as an edge weight) may first travel in one direction, then turn around and travel the other way for a while, then turn around and travel b...
https://ai.stackexchange.com/questions/27117/optimizer-that-prevents-parameters-from-oscillating
Question: <p>In doing a project using neural networks with an input layer, 4 hidden layers and an output layer ,I used mini batch gradient descent. I noticed that the randomly initialised weights seemed to do a good performance and gave a low error. As the model started training after about 200 iterations there was lar...
https://ai.stackexchange.com/questions/7362/behaviour-of-cost
Question: <p>I have a dataset with an input size of 155x155, with the output being 155 x 1 with a 3-4 layer neural net being used for regression. With such a small sample size, should I use full batch gradient descent (so all 155 samples) or use mini batch/stochastic gradient descent. I have read that using smaller min...
https://ai.stackexchange.com/questions/26468/should-i-use-batch-gradient-descent-when-i-have-a-small-sample-size
Question: <p>Let’s say I have a neural net doing classification and I’m doing stochastic gradient descent to train it. If I know that my current approximation is a decent approximation, can I conclude that my gradient is a decent approximation of the gradient of the true classifier everywhere?</p> <p>Specifically, sup...
https://ai.stackexchange.com/questions/8080/do-good-approximations-produce-good-gradients
Question: <p>I've come across the concept of fitness landscape before and, in my understanding, a smooth fitness landscape is one where the algorithm can converge on the global optimum through incremental movements or iterations across the landscape.</p> <p>My question is: <strong>Does deep learning assume that the fit...
https://ai.stackexchange.com/questions/27231/does-gradient-descent-in-deep-learning-assume-a-smooth-fitness-landscape