{
  "id": 229243,
  "title": "How are atoms numerated? And can transformers learn to numerate them?",
  "url": "/competitions/bms-molecular-translation/discussion/229243",
  "author_name": "",
  "post_date": "2021-03-29T07:10:17.972906200Z",
  "votes": 7,
  "comment_count": 9,
  "views": 0,
  "content": "<p>[Chemistry] What are the rules for assigning numbers to atoms? </p>\n<p>[Transformers] And do you think transformer can 'learn' these rules if we represent each number say until 50 as an individual tokens, given good enough visual and textual features? </p>",
  "messages": [
    {
      "id": "1255766",
      "postDate": "03/29/2021 07:10:17",
      "content": "<p>[Chemistry] What are the rules for assigning numbers to atoms? </p>\n<p>[Transformers] And do you think transformer can 'learn' these rules if we represent each number say until 50 as an individual tokens, given good enough visual and textual features? </p>",
      "rawMarkdown": "[Chemistry] What are the rules for assigning numbers to atoms? \n\n[Transformers] And do you think transformer can 'learn' these rules if we represent each number say until 50 as an individual tokens, given good enough visual and textual features?",
      "votes": null
    },
    {
      "id": "1255919",
      "postDate": "03/29/2021 11:07:50",
      "content": "<p>Quoting directly  from Heller et al.</p>\n<p><a href=\"https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\" target=\"_blank\">https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4</a></p>\n<p>\"Note that the canonical atomic numbers, which are used throughout the InChI, are always given in the formula’s element order. For example, “/C10H16N5O13P3” (the beginning of InChI for adenosine triphosphate) implies that atoms numbered 1–10 are carbons, 11–15 are nitrogens, 16–28 are oxygens, and 29–31 are phosporus. Hydrogen atoms are not explicitly numbered.\"</p>",
      "rawMarkdown": "Quoting directly  from Heller et al.\n\nhttps://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\n\n\"Note that the canonical atomic numbers, which are used throughout the InChI, are always given in the formula’s element order. For example, “/C10H16N5O13P3” (the beginning of InChI for adenosine triphosphate) implies that atoms numbered 1–10 are carbons, 11–15 are nitrogens, 16–28 are oxygens, and 29–31 are phosporus. Hydrogen atoms are not explicitly numbered.\"",
      "votes": null
    },
    {
      "id": "1255952",
      "postDate": "03/29/2021 11:53:07",
      "content": "<p>Oh, I mean the numeration in the atomic structure part of the InChI - c…</p>",
      "rawMarkdown": "Oh, I mean the numeration in the atomic structure part of the InChI - c...",
      "votes": null
    },
    {
      "id": "1255981",
      "postDate": "03/29/2021 12:46:53",
      "content": "<p><a href=\"https://www.kaggle.com/skull8888888\" target=\"_blank\">@skull8888888</a> - I think we mean the same thing. I assume you mean \"molecular structure\" in the usual sense of connected atoms. If you go to page 26 (et seq) of that Open Access paper, you'll find a detailed description of the algorithm used to assign numbers to atoms and list them and their connections in a particular order. </p>\n<p>Part of this is that (in the example I quoted) the numbers 1 to 10 would be assigned to the ten carbon atoms in ATP, the numbers 11, 12, 13, 14, 15 are the five nitrogens and so on. Look at Figure 2 on page 6 of their paper to see how this works in the context of the InChI for that molecule, which is:</p>\n<p>InChI=1S/C10H16N5O13P3/c11-8-5-9(13-2-12-8)15(3-14-5)10-7(17)6(16)4(26-10)1-25-30(21,22)28-31(23,24)27-29(18,19)20/h2-4,6-7,10,16-17H,1H2,(H,21,22)(H,23,24)(H2,11,12,13)H2,18,19,20)/t4-,6-,7-,10-/m1/s1</p>\n<p>(note that atom 5 is a carbon, the RHS of the figure wrongly shows it as nitrogen, the LHS is correct).</p>\n<p>One way to approach this competition would be first to go from images to graphs (i.e., connection tables of bonds between atoms) by image recognition. A second separate step would be to recode the InChI algorithm as described in that paper (that's the fullest description I can find).</p>",
      "rawMarkdown": "skull8888888 - I think we mean the same thing. I assume you mean \"molecular structure\" in the usual sense of connected atoms. If you go to page 26 (et seq) of that Open Access paper, you'll find a detailed description of the algorithm used to assign numbers to atoms and list them and their connections in a particular order. \n\nPart of this is that (in the example I quoted) the numbers 1 to 10 would be assigned to the ten carbon atoms in ATP, the numbers 11, 12, 13, 14, 15 are the five nitrogens and so on. Look at Figure 2 on page 6 of their paper to see how this works in the context of the InChI for that molecule, which is:\n\nInChI=1S/C10H16N5O13P3/c11-8-5-9(13-2-12-8)15(3-14-5)10-7(17)6(16)4(26-10)1-25-30(21,22)28-31(23,24)27-29(18,19)20/h2-4,6-7,10,16-17H,1H2,(H,21,22)(H,23,24)(H2,11,12,13)H2,18,19,20)/t4-,6-,7-,10-/m1/s1\n\n(note that atom 5 is a carbon, the RHS of the figure wrongly shows it as nitrogen, the LHS is correct).\n\nOne way to approach this competition would be first to go from images to graphs (i.e., connection tables of bonds between atoms) by image recognition. A second separate step would be to recode the InChI algorithm as described in that paper (that's the fullest description I can find).",
      "votes": null
    },
    {
      "id": "1256017",
      "postDate": "03/29/2021 13:18:18",
      "content": "<p>The node numbering is actually a graph algorithm (mathematical categories (i) Graph isomorphism and (ii) Canonical labeling), with additional condition that nodes 1-10 will be Carbon, etc</p>\n<p>For the mathematical details, see paper \"Practical graph isomorphism II\" by Brendan D.McKay, Adolfo Piperno<br>\n<a href=\"https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub\" target=\"_blank\">https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub</a></p>\n<p>Note: InChI is not supposed to be human-friendly.</p>",
      "rawMarkdown": "The node numbering is actually a graph algorithm (mathematical categories (i) Graph isomorphism and (ii) Canonical labeling), with additional condition that nodes 1-10 will be Carbon, etc\n\nFor the mathematical details, see paper \"Practical graph isomorphism II\" by Brendan D.McKay, Adolfo Piperno\n[https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub](https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub)\n\nNote: InChI is not supposed to be human-friendly.",
      "votes": null
    },
    {
      "id": "1256100",
      "postDate": "03/29/2021 14:41:42",
      "content": "<p>Thank you for a such detailed explanation! </p>",
      "rawMarkdown": "Thank you for a such detailed explanation!",
      "votes": null
    },
    {
      "id": "1259484",
      "postDate": "04/01/2021 12:58:42",
      "content": "<p>The link to the paper above doe snot work.  Here is the right one: <a href=\"https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\" target=\"_blank\">https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4</a></p>",
      "rawMarkdown": "The link to the paper above doe snot work.  Here is the right one: https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4",
      "votes": null
    },
    {
      "id": "1262207",
      "postDate": "04/04/2021 00:09:17",
      "content": "<p>My model (transformer-based decoder) represents numbers through using full token (e.g. 83) or combining two digits (e.g. 8 + 3) and I think both work well.</p>",
      "rawMarkdown": "My model (transformer-based decoder) represents numbers through using full token (e.g. 83) or combining two digits (e.g. 8 + 3) and I think both work well.",
      "votes": null
    },
    {
      "id": "1264221",
      "postDate": "04/06/2021 01:56:17",
      "content": "<p>Impressive! I am also using transformer decoder, but for me local cv is ~70. I suspect it is because I am simply resizing my images to 224 without keeping the ratio. What do you think, could it be the problem? </p>",
      "rawMarkdown": "Impressive! I am also using transformer decoder, but for me local cv is ~70. I suspect it is because I am simply resizing my images to 224 without keeping the ratio. What do you think, could it be the problem?",
      "votes": null
    },
    {
      "id": "1264237",
      "postDate": "04/06/2021 02:27:44",
      "content": "<p>usually aspect ratio is not the main reason of performance degradation. I think you'd better to increase the model capacity.</p>",
      "rawMarkdown": "usually aspect ratio is not the main reason of performance degradation. I think you'd better to increase the model capacity.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1255919,
      "author_name": "jbomitchell",
      "author_url": "",
      "post_date": "03/29/2021 11:07:50",
      "content": "<p>Quoting directly  from Heller et al.</p>\n<p><a href=\"https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\" target=\"_blank\">https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4</a></p>\n<p>\"Note that the canonical atomic numbers, which are used throughout the InChI, are always given in the formula’s element order. For example, “/C10H16N5O13P3” (the beginning of InChI for adenosine triphosphate) implies that atoms numbered 1–10 are carbons, 11–15 are nitrogens, 16–28 are oxygens, and 29–31 are phosporus. Hydrogen atoms are not explicitly numbered.\"</p>",
      "votes": null,
      "replies": [
        {
          "id": 1255952,
          "author_name": "skull8888888",
          "author_url": "",
          "post_date": "03/29/2021 11:53:07",
          "content": "<p>Oh, I mean the numeration in the atomic structure part of the InChI - c…</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1255981,
          "author_name": "jbomitchell",
          "author_url": "",
          "post_date": "03/29/2021 12:46:53",
          "content": "<p><a href=\"https://www.kaggle.com/skull8888888\" target=\"_blank\">@skull8888888</a> - I think we mean the same thing. I assume you mean \"molecular structure\" in the usual sense of connected atoms. If you go to page 26 (et seq) of that Open Access paper, you'll find a detailed description of the algorithm used to assign numbers to atoms and list them and their connections in a particular order. </p>\n<p>Part of this is that (in the example I quoted) the numbers 1 to 10 would be assigned to the ten carbon atoms in ATP, the numbers 11, 12, 13, 14, 15 are the five nitrogens and so on. Look at Figure 2 on page 6 of their paper to see how this works in the context of the InChI for that molecule, which is:</p>\n<p>InChI=1S/C10H16N5O13P3/c11-8-5-9(13-2-12-8)15(3-14-5)10-7(17)6(16)4(26-10)1-25-30(21,22)28-31(23,24)27-29(18,19)20/h2-4,6-7,10,16-17H,1H2,(H,21,22)(H,23,24)(H2,11,12,13)H2,18,19,20)/t4-,6-,7-,10-/m1/s1</p>\n<p>(note that atom 5 is a carbon, the RHS of the figure wrongly shows it as nitrogen, the LHS is correct).</p>\n<p>One way to approach this competition would be first to go from images to graphs (i.e., connection tables of bonds between atoms) by image recognition. A second separate step would be to recode the InChI algorithm as described in that paper (that's the fullest description I can find).</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1256100,
          "author_name": "skull8888888",
          "author_url": "",
          "post_date": "03/29/2021 14:41:42",
          "content": "<p>Thank you for a such detailed explanation! </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1259484,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "04/01/2021 12:58:42",
          "content": "<p>The link to the paper above doe snot work.  Here is the right one: <a href=\"https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\" target=\"_blank\">https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1256017,
      "author_name": "sirishks",
      "author_url": "",
      "post_date": "03/29/2021 13:18:18",
      "content": "<p>The node numbering is actually a graph algorithm (mathematical categories (i) Graph isomorphism and (ii) Canonical labeling), with additional condition that nodes 1-10 will be Carbon, etc</p>\n<p>For the mathematical details, see paper \"Practical graph isomorphism II\" by Brendan D.McKay, Adolfo Piperno<br>\n<a href=\"https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub\" target=\"_blank\">https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub</a></p>\n<p>Note: InChI is not supposed to be human-friendly.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1262207,
      "author_name": "affjljoo3581",
      "author_url": "",
      "post_date": "04/04/2021 00:09:17",
      "content": "<p>My model (transformer-based decoder) represents numbers through using full token (e.g. 83) or combining two digits (e.g. 8 + 3) and I think both work well.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1264221,
          "author_name": "skull8888888",
          "author_url": "",
          "post_date": "04/06/2021 01:56:17",
          "content": "<p>Impressive! I am also using transformer decoder, but for me local cv is ~70. I suspect it is because I am simply resizing my images to 224 without keeping the ratio. What do you think, could it be the problem? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1264237,
          "author_name": "affjljoo3581",
          "author_url": "",
          "post_date": "04/06/2021 02:27:44",
          "content": "<p>usually aspect ratio is not the main reason of performance degradation. I think you'd better to increase the model capacity.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1255766": "[Chemistry] What are the rules for assigning numbers to atoms? \n\n[Transformers] And do you think transformer can 'learn' these rules if we represent each number say until 50 as an individual tokens, given good enough visual and textual features?",
    "1255919": "Quoting directly  from Heller et al.\n\nhttps://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4\n\n\"Note that the canonical atomic numbers, which are used throughout the InChI, are always given in the formula’s element order. For example, “/C10H16N5O13P3” (the beginning of InChI for adenosine triphosphate) implies that atoms numbered 1–10 are carbons, 11–15 are nitrogens, 16–28 are oxygens, and 29–31 are phosporus. Hydrogen atoms are not explicitly numbered.\"",
    "1255952": "Oh, I mean the numeration in the atomic structure part of the InChI - c...",
    "1255981": "skull8888888 - I think we mean the same thing. I assume you mean \"molecular structure\" in the usual sense of connected atoms. If you go to page 26 (et seq) of that Open Access paper, you'll find a detailed description of the algorithm used to assign numbers to atoms and list them and their connections in a particular order. \n\nPart of this is that (in the example I quoted) the numbers 1 to 10 would be assigned to the ten carbon atoms in ATP, the numbers 11, 12, 13, 14, 15 are the five nitrogens and so on. Look at Figure 2 on page 6 of their paper to see how this works in the context of the InChI for that molecule, which is:\n\nInChI=1S/C10H16N5O13P3/c11-8-5-9(13-2-12-8)15(3-14-5)10-7(17)6(16)4(26-10)1-25-30(21,22)28-31(23,24)27-29(18,19)20/h2-4,6-7,10,16-17H,1H2,(H,21,22)(H,23,24)(H2,11,12,13)H2,18,19,20)/t4-,6-,7-,10-/m1/s1\n\n(note that atom 5 is a carbon, the RHS of the figure wrongly shows it as nitrogen, the LHS is correct).\n\nOne way to approach this competition would be first to go from images to graphs (i.e., connection tables of bonds between atoms) by image recognition. A second separate step would be to recode the InChI algorithm as described in that paper (that's the fullest description I can find).",
    "1256017": "The node numbering is actually a graph algorithm (mathematical categories (i) Graph isomorphism and (ii) Canonical labeling), with additional condition that nodes 1-10 will be Carbon, etc\n\nFor the mathematical details, see paper \"Practical graph isomorphism II\" by Brendan D.McKay, Adolfo Piperno\n[https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub](https://www.sciencedirect.com/science/article/pii/S0747717113001193?via%3Dihub)\n\nNote: InChI is not supposed to be human-friendly.",
    "1256100": "Thank you for a such detailed explanation!",
    "1259484": "The link to the paper above doe snot work.  Here is the right one: https://jcheminf.biomedcentral.com/articles/10.1186/s13321-015-0068-4",
    "1262207": "My model (transformer-based decoder) represents numbers through using full token (e.g. 83) or combining two digits (e.g. 8 + 3) and I think both work well.",
    "1264221": "Impressive! I am also using transformer decoder, but for me local cv is ~70. I suspect it is because I am simply resizing my images to 224 without keeping the ratio. What do you think, could it be the problem?",
    "1264237": "usually aspect ratio is not the main reason of performance degradation. I think you'd better to increase the model capacity."
  },
  "source": "meta"
}