{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/17168","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/17168/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/17168/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/17168/events","html_url":"https://github.com/tensorflow/tensorflow/issues/17168","id":298964690,"number":17168,"title":"Can you document tf metrics use in tf.keras?","user":{"login":"bhack","id":1710528,"avatar_url":"https://avatars0.githubusercontent.com/u/1710528?v=4","gravatar_id":"","url":"https://api.github.com/users/bhack","html_url":"https://github.com/bhack","followers_url":"https://api.github.com/users/bhack/followers","following_url":"https://api.github.com/users/bhack/following{/other_user}","gists_url":"https://api.github.com/users/bhack/gists{/gist_id}","starred_url":"https://api.github.com/users/bhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhack/subscriptions","organizations_url":"https://api.github.com/users/bhack/orgs","repos_url":"https://api.github.com/users/bhack/repos","events_url":"https://api.github.com/users/bhack/events{/privacy}","received_events_url":"https://api.github.com/users/bhack/received_events","type":"User","site_admin":false},"labels":[{"id":404586594,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/stat:awaiting%20tensorflower","name":"stat:awaiting tensorflower","color":"b60205","default":false},{"id":284443156,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/type:docs","name":"type:docs","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":{"login":"fchollet","id":710255,"avatar_url":"https://avatars3.githubusercontent.com/u/710255?v=4","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false},"assignees":[{"login":"fchollet","id":710255,"avatar_url":"https://avatars3.githubusercontent.com/u/710255?v=4","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-02-21T13:12:52Z","updated_at":"2018-04-30T21:13:58Z","closed_at":"2018-04-30T21:13:58Z","author_association":"NONE","body":"There is no official documentation on how to use tf metrics in tf.keras. \r\nTwo stackoverflow reference but I don't know if it is a API stable solution: \r\nhttps://stackoverflow.com/questions/45947351/how-to-use-tensorflow-metrics-in-keras\r\nhttps://stackoverflow.com/questions/43158719/how-can-i-use-tensorflow-metric-function-within-keras-models"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/385530828","html_url":"https://github.com/tensorflow/tensorflow/issues/17168#issuecomment-385530828","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/17168","id":385530828,"user":{"login":"fchollet","id":710255,"avatar_url":"https://avatars3.githubusercontent.com/u/710255?v=4","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false},"created_at":"2018-04-30T21:13:58Z","updated_at":"2018-04-30T21:13:58Z","author_association":"MEMBER","body":"This is generally not supported. But certain TF metrics can work with Keras.\r\n\r\nA metrics function, in Keras, for the time being, is a stateless tensor function that takes as arguments `(y_true, y_pred)` (target tensor and prediction tensor). If you're looking at a stateless TF metric (a metric that does not create weight variables in the background when you call it), then you can wrap it to have this signature, in most cases. Then you can pass the wrapped function to Keras.\r\n\r\nAny stateful metric, in Keras, should be implemented as a metrics layer. [Here is an example](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/_impl/keras/metrics_test.py#L81-L119).\r\n\r\nIn general, we recommend using only metrics from `tf.keras.metrics` with tf.keras. Yes, we're aware it's a bad UX to have multiple incompatible metrics modules, and we'll fix it in the future."}}
{"actor":{"display_login":"fchollet"}}