{
  "id": 151755,
  "title": "Kappa Cohen with Keras",
  "url": "/competitions/prostate-cancer-grade-assessment/discussion/151755",
  "author_name": "PAB97",
  "post_date": "2020-05-17T00:02:34.208000",
  "votes": 4,
  "comment_count": 5,
  "views": 0,
  "content": "<p>For those of you who might be wondering, you can actually use the Kappa Cohen quadratic-weighted metric with Keras.</p>\n\n<p>It is available in tensorflow-addons library: <a href=\"https://www.tensorflow.org/addons/overview\">https://www.tensorflow.org/addons/overview</a></p>\n\n<p>Make sure to upgrade the Tensorflow version of your environment (TF should be version 2.2). </p>\n\n<p>Then you just need to call <code>tfa.metrics.CohenKappa(weightage='quadratic', num_classes=6)</code> and you are good to go ;)</p>",
  "messages": [
    {
      "id": 850705,
      "postDate": "2020-05-17T00:02:34.210Z",
      "content": "<p>For those of you who might be wondering, you can actually use the Kappa Cohen quadratic-weighted metric with Keras.</p>\n\n<p>It is available in tensorflow-addons library: <a href=\"https://www.tensorflow.org/addons/overview\">https://www.tensorflow.org/addons/overview</a></p>\n\n<p>Make sure to upgrade the Tensorflow version of your environment (TF should be version 2.2). </p>\n\n<p>Then you just need to call <code>tfa.metrics.CohenKappa(weightage='quadratic', num_classes=6)</code> and you are good to go ;)</p>",
      "rawMarkdown": "For those of you who might be wondering, you can actually use the Kappa Cohen quadratic-weighted metric with Keras.\n\nIt is available in tensorflow-addons library: https://www.tensorflow.org/addons/overview\n\nMake sure to upgrade the Tensorflow version of your environment (TF should be version 2.2). \n\nThen you just need to call `tfa.metrics.CohenKappa(weightage='quadratic', num_classes=6)` and you are good to go ;)",
      "votes": 4
    },
    {
      "id": 860495,
      "postDate": "2020-05-25T10:58:40.957Z",
      "content": "<p>yes. its not TF2.2</p>",
      "rawMarkdown": "yes. its not TF2.2"
    },
    {
      "id": 856254,
      "postDate": "2020-05-21T15:49:34.243Z",
      "content": "<p>Current TF2.2 is not in Kaggle notebooks right?</p>",
      "rawMarkdown": "Current TF2.2 is not in Kaggle notebooks right?"
    },
    {
      "id": 855958,
      "postDate": "2020-05-21T11:16:39.007Z",
      "content": "<p>When I tired it on kaggle notebook using following code:\n!pip install tensorflow-addons\nimport tensorflow_addons as tfa</p>\n\n<p><strong>getting error like:</strong>\n/opt/conda/lib/python3.7/site-packages/tensorflow_addons/utils/ensure_tf_install.py:68: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.2.0 and strictly below 2.3.0 (nightly versions are not supported). \n The versions of TensorFlow you are currently using is 2.1.0 and is not supported. \nSome things might work, some things might not.\nIf you were to encounter a bug, do not file an issue.\nIf you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. \nYou can find the compatibility matrix in TensorFlow Addon's readme:\n<a href=\"https://github.com/tensorflow/addons\">https://github.com/tensorflow/addons</a>\n  UserWarning,</p>\n\n<p><strong>AttributeError: module 'tensorflow_core._api.v2.random' has no attribute 'Generator'</strong></p>\n\n<p>Will appreciate any pointers</p>",
      "rawMarkdown": "When I tired it on kaggle notebook using following code:\n!pip install tensorflow-addons\nimport tensorflow_addons as tfa\n\n**getting error like:**\n/opt/conda/lib/python3.7/site-packages/tensorflow_addons/utils/ensure_tf_install.py:68: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.2.0 and strictly below 2.3.0 (nightly versions are not supported). \n The versions of TensorFlow you are currently using is 2.1.0 and is not supported. \nSome things might work, some things might not.\nIf you were to encounter a bug, do not file an issue.\nIf you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. \nYou can find the compatibility matrix in TensorFlow Addon's readme:\nhttps://github.com/tensorflow/addons\n  UserWarning,\n\n**AttributeError: module 'tensorflow_core._api.v2.random' has no attribute 'Generator'**\n\n\nWill appreciate any pointers",
      "replies": [
        {
          "id": 885242,
          "postDate": "2020-06-14T03:42:47.660Z",
          "content": "<p>I am running into the same problem. I submitted an issue <a href=\"https://github.com/tensorflow/addons/issues/1927\">here</a>. Check out for updates.</p>",
          "rawMarkdown": "I am running into the same problem. I submitted an issue [here](https://github.com/tensorflow/addons/issues/1927). Check out for updates."
        }
      ]
    },
    {
      "id": 850917,
      "postDate": "2020-05-17T06:58:38.173Z",
      "content": "<p>Interesting thing is I am able to run this thing from long time even right now, when I have tf 2.1, it all works like it should.</p>",
      "rawMarkdown": "Interesting thing is I am able to run this thing from long time even right now, when I have tf 2.1, it all works like it should."
    }
  ],
  "comments": [
    {
      "id": 860495,
      "author_name": "Mugdha Hardikar",
      "author_url": "",
      "post_date": "2020-05-25T10:58:40.957000",
      "content": "<p>yes. its not TF2.2</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 856254,
      "author_name": "Kurian Benoy",
      "author_url": "",
      "post_date": "2020-05-21T15:49:34.243000",
      "content": "<p>Current TF2.2 is not in Kaggle notebooks right?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 855958,
      "author_name": "Mugdha Hardikar",
      "author_url": "",
      "post_date": "2020-05-21T11:16:39.007000",
      "content": "<p>When I tired it on kaggle notebook using following code:\n!pip install tensorflow-addons\nimport tensorflow_addons as tfa</p>\n\n<p><strong>getting error like:</strong>\n/opt/conda/lib/python3.7/site-packages/tensorflow_addons/utils/ensure_tf_install.py:68: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.2.0 and strictly below 2.3.0 (nightly versions are not supported). \n The versions of TensorFlow you are currently using is 2.1.0 and is not supported. \nSome things might work, some things might not.\nIf you were to encounter a bug, do not file an issue.\nIf you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. \nYou can find the compatibility matrix in TensorFlow Addon's readme:\n<a href=\"https://github.com/tensorflow/addons\">https://github.com/tensorflow/addons</a>\n  UserWarning,</p>\n\n<p><strong>AttributeError: module 'tensorflow_core._api.v2.random' has no attribute 'Generator'</strong></p>\n\n<p>Will appreciate any pointers</p>",
      "votes": 0,
      "replies": [
        {
          "id": 885242,
          "author_name": "sm_erlo",
          "author_url": "",
          "post_date": "2020-06-14T03:42:47.660000",
          "content": "<p>I am running into the same problem. I submitted an issue <a href=\"https://github.com/tensorflow/addons/issues/1927\">here</a>. Check out for updates.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 850917,
      "author_name": "Harshit Sheoran",
      "author_url": "",
      "post_date": "2020-05-17T06:58:38.173000",
      "content": "<p>Interesting thing is I am able to run this thing from long time even right now, when I have tf 2.1, it all works like it should.</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "850705": "For those of you who might be wondering, you can actually use the Kappa Cohen quadratic-weighted metric with Keras.\n\nIt is available in tensorflow-addons library: https://www.tensorflow.org/addons/overview\n\nMake sure to upgrade the Tensorflow version of your environment (TF should be version 2.2). \n\nThen you just need to call `tfa.metrics.CohenKappa(weightage='quadratic', num_classes=6)` and you are good to go ;)",
    "860495": "yes. its not TF2.2",
    "856254": "Current TF2.2 is not in Kaggle notebooks right?",
    "855958": "When I tired it on kaggle notebook using following code:\n!pip install tensorflow-addons\nimport tensorflow_addons as tfa\n\n**getting error like:**\n/opt/conda/lib/python3.7/site-packages/tensorflow_addons/utils/ensure_tf_install.py:68: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.2.0 and strictly below 2.3.0 (nightly versions are not supported). \n The versions of TensorFlow you are currently using is 2.1.0 and is not supported. \nSome things might work, some things might not.\nIf you were to encounter a bug, do not file an issue.\nIf you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. \nYou can find the compatibility matrix in TensorFlow Addon's readme:\nhttps://github.com/tensorflow/addons\n  UserWarning,\n\n**AttributeError: module 'tensorflow_core._api.v2.random' has no attribute 'Generator'**\n\n\nWill appreciate any pointers",
    "850917": "Interesting thing is I am able to run this thing from long time even right now, when I have tf 2.1, it all works like it should."
  }
}