GithubHelp home page GithubHelp logo

Weights for examples about matconvnet HOT 4 CLOSED

vlfeat avatar vlfeat commented on May 2, 2024
Weights for examples

from matconvnet.

Comments (4)

lenck avatar lenck commented on May 2, 2024

Hi, I think that this may be little bit complicated because the derivatives are collected over a batch inside the e.g. vl_nnconv.cu... So you would probably need to change the mex files and have adjustable alpha parameter in the sgemm operation for the backrpop (e.g. on line 820 in vl_nnconv.cu but on many more places too...).

But if you want to just have a proof of concept, and you don't mind that the computation would take longer, you can pass batches of size 1 and then integrate the gradients in Matlab... Simplest would be to have your own version of vl_simplenn which would iterate over all images in a batch summing up the derivatives...

from matconvnet.

lenck avatar lenck commented on May 2, 2024

Hmm, just realised that I might have been wrong about this - you just need to change the softmaxloss function implementation to weight the loss per learning example... [feeling stupid]

from matconvnet.

dbbert avatar dbbert commented on May 2, 2024

How would I go about changing the softmaxloss function to weigh the examples?

I would adapt lines 59-60 as follows, where the weights vector is based on the label vector c:

t = Xmax + log(sum(ex,3)) - reshape(X(c_), [sz(1:2) 1 sz(4)]) ;
t = t .* weights;
Y = sum(t(:)) / n ;

But what about the backward step?

from matconvnet.

shenyu2013 avatar shenyu2013 commented on May 2, 2024

I also have this problem. After changing the softmaxloss function to weight the examples, how to change the backpropagation steps?
I have tried it if nothing is done, that would cause NaNs and no regression.

from matconvnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.