{
  "id": 224232,
  "title": "Optimizing Levenshtein distance doubt",
  "url": "/competitions/bms-molecular-translation/discussion/224232",
  "author_name": "",
  "post_date": "2021-03-07T12:35:53.502927900Z",
  "votes": 6,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I'm working in PyTorch and while implementing I faced an issue. The evaluation metric for the competition is Levenshtein distance, so how do I go about training my model? I ran a quick google search but Levenshtein distance as a loss function doesn't seem to be too common. Is calculating Levenshtein distance and optimizing it on the fly the way to go? Or can Levenshtein distance somehow be indirectly minimized?</p>",
  "messages": [
    {
      "id": "1229565",
      "postDate": "03/07/2021 12:35:53",
      "content": "<p>I'm working in PyTorch and while implementing I faced an issue. The evaluation metric for the competition is Levenshtein distance, so how do I go about training my model? I ran a quick google search but Levenshtein distance as a loss function doesn't seem to be too common. Is calculating Levenshtein distance and optimizing it on the fly the way to go? Or can Levenshtein distance somehow be indirectly minimized?</p>",
      "rawMarkdown": "I'm working in PyTorch and while implementing I faced an issue. The evaluation metric for the competition is Levenshtein distance, so how do I go about training my model? I ran a quick google search but Levenshtein distance as a loss function doesn't seem to be too common. Is calculating Levenshtein distance and optimizing it on the fly the way to go? Or can Levenshtein distance somehow be indirectly minimized?",
      "votes": null
    },
    {
      "id": "1229714",
      "postDate": "03/07/2021 15:03:29",
      "content": "<p>I suspect that it will be easier to use other metrics to train your model, but to use the competition metric for hyperparameter choice, early stopping or model selection.</p>",
      "rawMarkdown": "I suspect that it will be easier to use other metrics to train your model, but to use the competition metric for hyperparameter choice, early stopping or model selection.",
      "votes": null
    },
    {
      "id": "1230056",
      "postDate": "03/07/2021 18:44:03",
      "content": "<p>I don't believe the Levenshtein distance can be used as a loss, since it's non differentiable. As Björn points out, it is probably best to use this a metric for hyperparameter selection, model selection, etc.</p>",
      "rawMarkdown": "I don't believe the Levenshtein distance can be used as a loss, since it's non differentiable. As Björn points out, it is probably best to use this a metric for hyperparameter selection, model selection, etc.",
      "votes": null
    },
    {
      "id": "1230354",
      "postDate": "03/08/2021 03:55:05",
      "content": "<p>Yeah, I thought so. Thanks for clearing it up 🙂</p>",
      "rawMarkdown": "Yeah, I thought so. Thanks for clearing it up 🙂",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1229714,
      "author_name": "bjoernholzhauer",
      "author_url": "",
      "post_date": "03/07/2021 15:03:29",
      "content": "<p>I suspect that it will be easier to use other metrics to train your model, but to use the competition metric for hyperparameter choice, early stopping or model selection.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1230056,
      "author_name": "matthewmasters",
      "author_url": "",
      "post_date": "03/07/2021 18:44:03",
      "content": "<p>I don't believe the Levenshtein distance can be used as a loss, since it's non differentiable. As Björn points out, it is probably best to use this a metric for hyperparameter selection, model selection, etc.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1230354,
          "author_name": "arka47",
          "author_url": "",
          "post_date": "03/08/2021 03:55:05",
          "content": "<p>Yeah, I thought so. Thanks for clearing it up 🙂</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1229565": "I'm working in PyTorch and while implementing I faced an issue. The evaluation metric for the competition is Levenshtein distance, so how do I go about training my model? I ran a quick google search but Levenshtein distance as a loss function doesn't seem to be too common. Is calculating Levenshtein distance and optimizing it on the fly the way to go? Or can Levenshtein distance somehow be indirectly minimized?",
    "1229714": "I suspect that it will be easier to use other metrics to train your model, but to use the competition metric for hyperparameter choice, early stopping or model selection.",
    "1230056": "I don't believe the Levenshtein distance can be used as a loss, since it's non differentiable. As Björn points out, it is probably best to use this a metric for hyperparameter selection, model selection, etc.",
    "1230354": "Yeah, I thought so. Thanks for clearing it up 🙂"
  },
  "source": "meta"
}