{
  "id": 535550,
  "title": "Evaluation funciton",
  "url": "/competitions/child-mind-institute-problematic-internet-use/discussion/535550",
  "author_name": "",
  "post_date": "2024-09-22T19:20:33.746113800Z",
  "votes": 2,
  "comment_count": 1,
  "views": 0,
  "content": "<p>I fed the evaluation metric into chatgpt and this is what it came up with for a custom function I could use with lightGBM… Anyone know if this is right? The numbers it comes back with seem reasonable..</p>\n<pre><code> sklearn.metrics  cohen_kappa_score\n numpy  np\n\n ():\n    y_true = data.get_label()  \n    \n     (y_pred.shape) &gt; :\n        y_pred = np.argmax(y_pred, axis=)  \n    \n     , cohen_kappa_score(y_true, y_pred, weights=), \n</code></pre>",
  "messages": [
    {
      "id": "2995945",
      "postDate": "09/22/2024 19:20:33",
      "content": "<p>I fed the evaluation metric into chatgpt and this is what it came up with for a custom function I could use with lightGBM… Anyone know if this is right? The numbers it comes back with seem reasonable..</p>\n<pre><code> sklearn.metrics  cohen_kappa_score\n numpy  np\n\n ():\n    y_true = data.get_label()  \n    \n     (y_pred.shape) &gt; :\n        y_pred = np.argmax(y_pred, axis=)  \n    \n     , cohen_kappa_score(y_true, y_pred, weights=), \n</code></pre>",
      "rawMarkdown": "I fed the evaluation metric into chatgpt and this is what it came up with for a custom function I could use with lightGBM... Anyone know if this is right? The numbers it comes back with seem reasonable..\n\n```python\nfrom sklearn.metrics import cohen_kappa_score\nimport numpy as np\n\ndef quadratic_weighted_kappa(y_pred, data):\n    y_true = data.get_label()  # Get true labels from the Dataset object\n    # Check if the predictions are probabilities (2D array)\n    if len(y_pred.shape) > 1:\n        y_pred = np.argmax(y_pred, axis=1)  # Get the predicted class (highest probability)\n    # If it's already 1D, assume it's the class predictions\n    return 'qwk', cohen_kappa_score(y_true, y_pred, weights='quadratic'), True\n\n```",
      "votes": null
    },
    {
      "id": "2996533",
      "postDate": "09/23/2024 15:37:44",
      "content": "<p><a href=\"https://www.kaggle.com/beezus666\" target=\"_blank\">@beezus666</a> this can use used with lightgbm when you use the native booster algorithm syntax. You need to ensure you have a proper <code>lightgbm.dataset</code> here as the training set. </p>",
      "rawMarkdown": "beezus666 this can use used with lightgbm when you use the native booster algorithm syntax. You need to ensure you have a proper `lightgbm.dataset` here as the training set.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2996533,
      "author_name": "ravi20076",
      "author_url": "",
      "post_date": "09/23/2024 15:37:44",
      "content": "<p><a href=\"https://www.kaggle.com/beezus666\" target=\"_blank\">@beezus666</a> this can use used with lightgbm when you use the native booster algorithm syntax. You need to ensure you have a proper <code>lightgbm.dataset</code> here as the training set. </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2995945": "I fed the evaluation metric into chatgpt and this is what it came up with for a custom function I could use with lightGBM... Anyone know if this is right? The numbers it comes back with seem reasonable..\n\n```python\nfrom sklearn.metrics import cohen_kappa_score\nimport numpy as np\n\ndef quadratic_weighted_kappa(y_pred, data):\n    y_true = data.get_label()  # Get true labels from the Dataset object\n    # Check if the predictions are probabilities (2D array)\n    if len(y_pred.shape) > 1:\n        y_pred = np.argmax(y_pred, axis=1)  # Get the predicted class (highest probability)\n    # If it's already 1D, assume it's the class predictions\n    return 'qwk', cohen_kappa_score(y_true, y_pred, weights='quadratic'), True\n\n```",
    "2996533": "beezus666 this can use used with lightgbm when you use the native booster algorithm syntax. You need to ensure you have a proper `lightgbm.dataset` here as the training set."
  },
  "source": "meta"
}