Comments (2)
https://github.com/naya0000/cs231n/blob/e1192dc8cbaf078c3cfb691e12b8d6d2ec40c8fa/assignment1/cs231n/classifiers/linear_svm.py#L110 Can someone explain why this subtraction is done? An explanation for derivative calculation.
Please see the figure for the computational graph of hinge loss @mmuneeburahman.
Performing the backprop based on the computational graph, we will get the desire result as what the code is doing. The subtraction term comes from the part I have circled in red.
from cs231n.
Code-wise, since w
) is used to calculate both Y_hat
) and y_hat_true
), they both contribute to the derivative of dW
) as you can see from this line:
margins = np.maximum(0, Y_hat - y_hat_true + 1)
By computing (margins > 0).sum(axis=1)
, we compute how many times W
was used to calculate y_hat_true
, i.e., how many times it contributed to the loss through y_hat_true
. We negate it because y_hat_true
is negative when computing margins
.
from cs231n.
Related Issues (12)
- Assignment1 knn Inline question 2 is incorrect HOT 2
- The problem in the conv_backward_naive HOT 2
- Can I run assignment3 locally? HOT 7
- can not get the relative error which is less than e-3. HOT 14
- "two_layer_net.ipynb" Solver section default setting problem HOT 1
- Assignment2/cs231n/layers.py line 482: "np.random.rand" rather than "np.random.randn" HOT 1
- KNN, Inline Q2 Rotation. HOT 1
- softmax_loss derivative -1 subtraction HOT 2
- I think Inline question 2 is False
- Regarding eval_numerical_gradient_array HOT 6
- Output of dropout notebook (assignment 2) seems wrong HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cs231n.