{
  "id": 373466,
  "title": "Faster competition metrics ⚡️",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/373466",
  "author_name": "toomuch",
  "post_date": "2022-12-21T16:21:51.456000",
  "votes": 4,
  "comment_count": 1,
  "views": 0,
  "content": "<pre><code> ():\n    \n    ctp = np.dot(probs, y_test.astype())\n    cfp = np.(probs) - ctp\n    c_precision = ctp / (ctp + cfp + eps)\n    c_recall = ctp / (np.(y_test) + eps)\n    cf1 =  * (c_precision * c_recall) / (c_precision + c_recall + eps)\n     {\n        : ctp,\n        : cfp,\n        : c_recall,\n        : c_precision,\n        : cf1,\n    }\n</code></pre>",
  "messages": [
    {
      "id": 2072042,
      "postDate": "2022-12-21T16:21:51.457Z",
      "content": "<pre><code> ():\n    \n    ctp = np.dot(probs, y_test.astype())\n    cfp = np.(probs) - ctp\n    c_precision = ctp / (ctp + cfp + eps)\n    c_recall = ctp / (np.(y_test) + eps)\n    cf1 =  * (c_precision * c_recall) / (c_precision + c_recall + eps)\n     {\n        : ctp,\n        : cfp,\n        : c_recall,\n        : c_precision,\n        : cf1,\n    }\n</code></pre>",
      "rawMarkdown": "```python\ndef c_metrics(probs, y_test, eps: Optional[float] = 1e-8):\n    \"\"\" Сalculation of metrics in vectorized format. \n    Robust to batch without positive classes (y_true_count\n     == 0)\n\n    Args:\n        probs (np.ndarray): flat numpy NDArray containing \n            probabilities of positive class.\n        y_test (np.ndarray): flat numpy NDArray containing\n            ground truth labels.\n        eps (float, optional): machine epsilon. Defaults to \n            1e-8.\n\n    Returns:\n        Dict[str, float]: continious classification metrics\n    \"\"\"\n    ctp = np.dot(probs, y_test.astype(bool))\n    cfp = np.sum(probs) - ctp\n    c_precision = ctp / (ctp + cfp + eps)\n    c_recall = ctp / (np.sum(y_test) + eps)\n    cf1 = 2 * (c_precision * c_recall) / (c_precision + c_recall + eps)\n    return {\n        \"ctp\": ctp,\n        \"cfp\": cfp,\n        \"c_recall\": c_recall,\n        \"c_precision\": c_precision,\n        \"cf1\": cf1,\n    }\n```",
      "votes": 4
    },
    {
      "id": 2152384,
      "postDate": "2023-02-20T19:13:19.037Z",
      "content": "<p>If I utilize this in the future, under which license this is published?</p>",
      "rawMarkdown": "If I utilize this in the future, under which license this is published?"
    }
  ],
  "comments": [
    {
      "id": 2152384,
      "author_name": "Antti Isosalo",
      "author_url": "",
      "post_date": "2023-02-20T19:13:19.037000",
      "content": "<p>If I utilize this in the future, under which license this is published?</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2072042": "```python\ndef c_metrics(probs, y_test, eps: Optional[float] = 1e-8):\n    \"\"\" Сalculation of metrics in vectorized format. \n    Robust to batch without positive classes (y_true_count\n     == 0)\n\n    Args:\n        probs (np.ndarray): flat numpy NDArray containing \n            probabilities of positive class.\n        y_test (np.ndarray): flat numpy NDArray containing\n            ground truth labels.\n        eps (float, optional): machine epsilon. Defaults to \n            1e-8.\n\n    Returns:\n        Dict[str, float]: continious classification metrics\n    \"\"\"\n    ctp = np.dot(probs, y_test.astype(bool))\n    cfp = np.sum(probs) - ctp\n    c_precision = ctp / (ctp + cfp + eps)\n    c_recall = ctp / (np.sum(y_test) + eps)\n    cf1 = 2 * (c_precision * c_recall) / (c_precision + c_recall + eps)\n    return {\n        \"ctp\": ctp,\n        \"cfp\": cfp,\n        \"c_recall\": c_recall,\n        \"c_precision\": c_precision,\n        \"cf1\": cf1,\n    }\n```",
    "2152384": "If I utilize this in the future, under which license this is published?"
  }
}