GithubHelp home page GithubHelp logo

Comments (4)

NELSONZHAO avatar NELSONZHAO commented on May 12, 2024 1

Hi,当初我的考虑是这样的。因为train和val的数据都是有label的,所以在计算loss,我全部使用trainhelper,保证他们计算loss时分布一样。如果在val使用infer的话,loss要大的很多,而且数据分布也改变了。test阶段使用infer是因为我们没有了label。所以train和val我都用trainhelper是为了让他们loss具有可比性。

from zhihu.

NELSONZHAO avatar NELSONZHAO commented on May 12, 2024

我看了下代码,val和train是分开计算的,可以贴下你说的代码位置吗

from zhihu.

yuyue9284 avatar yuyue9284 commented on May 12, 2024

您好,就是cost的定义部分是

cost = tf.contrib.seq2seq.sequence_loss(
            training_logits,
            targets,
            masks)

然后在计算validatoin loss 部分还是调用的cost,虽然输入数据时用的是validation data,但是由于上面cost计算用的是training_logits,最后应该还是用的training decoder的输出,而不是用的predicting decoder。

# 计算validation loss
                validation_loss = sess.run(
                [cost],
                {input_data: valid_sources_batch,
                 targets: valid_targets_batch,
                 lr: learning_rate,
                 target_sequence_length: valid_targets_lengths,
                 source_sequence_length: valid_sources_lengths})

from zhihu.

yuyue9284 avatar yuyue9284 commented on May 12, 2024

了解了,谢谢,这个系列太好了,对学习很有帮助👍!

from zhihu.

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.