Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义评估函数 #35

Open
weiarqq opened this issue Apr 25, 2020 · 1 comment
Open

自定义评估函数 #35

weiarqq opened this issue Apr 25, 2020 · 1 comment

Comments

@weiarqq
Copy link

weiarqq commented Apr 25, 2020

`@tf.function
def update_state(self,y_true,y_pred):
y_true = tf.cast(tf.reshape(y_true,(-1,)),tf.bool)
y_pred = tf.cast(100*tf.reshape(y_pred,(-1,)),tf.int32)

    for i in tf.range(0,tf.shape(y_true)[0]):
        if y_true[i]:
            self.true_positives[y_pred[i]].assign(
                self.true_positives[y_pred[i]]+1.0)
        else:
            self.false_positives[y_pred[i]].assign(
                self.false_positives[y_pred[i]]+1.0)
    return (self.true_positives,self.false_positives)`

在2.1中 输入应该添加 sample_weight=None, 而且返回值只能选择一个

@weiarqq weiarqq closed this as completed Apr 25, 2020
@weiarqq weiarqq reopened this Apr 25, 2020
@lyhue1991
Copy link
Owner

感谢反馈,但是没有太看明白你的问题呢 @weiarqq 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants