Code Monkey home page Code Monkey logo

Comments (1)

zezhishao avatar zezhishao commented on September 22, 2024

您可以参考STEP的loss
总的来说,目前自定义loss函数的参数输入需要满足下述限制:

def customized_loss(prediction, real_value, other_param_1, other_param_2, ..., null_val=np.nan):
    # main loss
    pass

其中,prediction, real_value, other_param_1, other_param_2, ...,这些参数是和runner的forward函数的返回值相匹配的。换句话说,runner的返回值会自动作为参数注入到loss中。同理您可以参考STEP的runner

最后一个参数,null_val是用来识别数据集中需要被忽略的异常点,默认一般为np.nan。您可以通过CFG.NULL_VAL在配置文件中进行设定。例如,对于交通数据集来说,0值一般是异常值(传感器宕机)。我们不希望模型强制拟合这些异常值,此时的NULL_VAL就会被设定为0.0,再进一步采用masked_mae等指标。

from basicts.

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.