GithubHelp home page GithubHelp logo

Weighted loss about pystruct HOT 9 OPEN

pystruct avatar pystruct commented on August 20, 2024
Weighted loss

from pystruct.

Comments (9)

amueller avatar amueller commented on August 20, 2024

You are right, that would be a nice enhancement. It would be quite easy if we changed the interface of loss to also contain x. Then you could store the weighting factor in x and use that in the loss.

from pystruct.

al13n321 avatar al13n321 commented on August 20, 2024

Yep, I'm adding x argument to all loss() functions all over the code right now.

from pystruct.

amueller avatar amueller commented on August 20, 2024

Cool. Do you think it is feasible to do this in a backward-compatible way?
I think I would add it as a last and optional argument for the models, so that they would also work with learners that don't do it. But I don't see an easy way to make the new learners work with models that don't take an x.

from pystruct.

al13n321 avatar al13n321 commented on August 20, 2024

I don't know how to add weights to all models without going through all the code, so I'll probably only add support for weights to EdgeFeatureGraphCRF (since I'm currently only interested in it). I'm thinking to just check the length of x tuple to decide if the weights are given and the loss should be weighted.

from pystruct.

amueller avatar amueller commented on August 20, 2024

I would rather create a new model that inherits from EdgeFeatureGraphCRF which always wants weighted nodes. If that is too complicated, I'd at least add a boolean parameter.
If you inherit and create a new model, you only have to write a new loss and overwrite the function that checks x to be in the correct format.

from pystruct.

zaxtax avatar zaxtax commented on August 20, 2024

+1 for boolean parameter that can be checked if loss is weighted.
On Oct 26, 2013 7:33 PM, "Andreas Mueller" [email protected] wrote:

I would rather create a new model that inherits from EdgeFeatureGraphCRFwhich always wants weighted nodes. If that is too complicated, I'd at least
add a boolean parameter.
If you inherit and create a new model, you only have to write a new lossand overwrite the function that checks
x to be in the correct format.


Reply to this email directly or view it on GitHubhttps://github.com//issues/94#issuecomment-27158238
.

from pystruct.

amueller avatar amueller commented on August 20, 2024

Ideally, this should be implemented in a way that also includes the class_weight option. That is currently hacked in a bit. Maybe the class_weight should be implemented in terms of instance weights?

from pystruct.

al13n321 avatar al13n321 commented on August 20, 2024

Yeah, class_weight seems redundant when nodes can have weights, but still more convenient. EdgeFeatureGraphCRF could translate class weights to node weights so that lower levels don't have know about class weights.

from pystruct.

amueller avatar amueller commented on August 20, 2024

exactly :)

from pystruct.

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.