{
  "id": 105133,
  "title": "Suggestions on fast iterative improvement for [G]NN based models",
  "url": "/competitions/champs-scalar-coupling/discussion/105133",
  "author_name": "",
  "post_date": "2019-08-21T11:57:45.622615200Z",
  "votes": 1,
  "comment_count": 8,
  "views": 0,
  "content": "<p>For past 10 days or so I've been trying to get GNN working. I took GNN code from <a href=\"/fnands\">@fnands</a>'s very  very helpful kernel. <a href=\"https://www.kaggle.com/fnands/1-mpnn\">https://www.kaggle.com/fnands/1-mpnn</a> .  I'm, however, using my own features.   I'm using normalized version of the features (+one hot encoding for categorical ones) I developed for tree based Catboost model. With GNN I've reached -1.54 on my validation set. However, 5 fold group validation based Catboost model gives me -1.95 on my validation set and -2.0 on LB.</p>\n\n<p>I'm struggling to speed up the iteration for my GNN. In tree based models, it is relatively simpler as\n1. <strong>Explicit feature importances</strong> are present.: With permutation importance (<a href=\"https://www.kaggle.com/speedwagon/permutation-importance\">https://www.kaggle.com/speedwagon/permutation-importance</a>) I'm trying to manage this for GNN.  </p>\n\n<ol>\n<li><strong>Run time</strong> is quite less for tree based models. Just 25 iterations of GNN takes about 8 hours ! </li>\n</ol>\n\n<p>For run time improvement, one way could be to remove the redundant data. In <a href=\"/fnands\">@fnands</a> implementation,  I see that 95% of edges data is just zeros. It is because the edge data is multi dimensional. 2 dimensional representation of edge data is much more compact but less 'numpy parallelizable'. So no clear way here. </p>\n\n<p>I use kaggle kernels for GPU . I know here there are many experienced people here.  I'm very much interested in knowing how people improve upon their neural network models in a time efficient way (with meagre resources :D ). All suggestions are much appreciated !</p>\n\n<p>Thanks !!</p>",
  "messages": [
    {
      "id": "604449",
      "postDate": "08/21/2019 11:57:45",
      "content": "<p>For past 10 days or so I've been trying to get GNN working. I took GNN code from <a href=\"/fnands\">@fnands</a>'s very  very helpful kernel. <a href=\"https://www.kaggle.com/fnands/1-mpnn\">https://www.kaggle.com/fnands/1-mpnn</a> .  I'm, however, using my own features.   I'm using normalized version of the features (+one hot encoding for categorical ones) I developed for tree based Catboost model. With GNN I've reached -1.54 on my validation set. However, 5 fold group validation based Catboost model gives me -1.95 on my validation set and -2.0 on LB.</p>\n\n<p>I'm struggling to speed up the iteration for my GNN. In tree based models, it is relatively simpler as\n1. <strong>Explicit feature importances</strong> are present.: With permutation importance (<a href=\"https://www.kaggle.com/speedwagon/permutation-importance\">https://www.kaggle.com/speedwagon/permutation-importance</a>) I'm trying to manage this for GNN.  </p>\n\n<ol>\n<li><strong>Run time</strong> is quite less for tree based models. Just 25 iterations of GNN takes about 8 hours ! </li>\n</ol>\n\n<p>For run time improvement, one way could be to remove the redundant data. In <a href=\"/fnands\">@fnands</a> implementation,  I see that 95% of edges data is just zeros. It is because the edge data is multi dimensional. 2 dimensional representation of edge data is much more compact but less 'numpy parallelizable'. So no clear way here. </p>\n\n<p>I use kaggle kernels for GPU . I know here there are many experienced people here.  I'm very much interested in knowing how people improve upon their neural network models in a time efficient way (with meagre resources :D ). All suggestions are much appreciated !</p>\n\n<p>Thanks !!</p>",
      "rawMarkdown": "For past 10 days or so I've been trying to get GNN working. I took GNN code from @fnands's very  very helpful kernel. https://www.kaggle.com/fnands/1-mpnn .  I'm, however, using my own features.   I'm using normalized version of the features (+one hot encoding for categorical ones) I developed for tree based Catboost model. With GNN I've reached -1.54 on my validation set. However, 5 fold group validation based Catboost model gives me -1.95 on my validation set and -2.0 on LB.\n \nI'm struggling to speed up the iteration for my GNN. In tree based models, it is relatively simpler as\n1. **Explicit feature importances** are present.: With permutation importance (https://www.kaggle.com/speedwagon/permutation-importance) I'm trying to manage this for GNN.  \n\n2. **Run time** is quite less for tree based models. Just 25 iterations of GNN takes about 8 hours ! \n\nFor run time improvement, one way could be to remove the redundant data. In @fnands implementation,  I see that 95% of edges data is just zeros. It is because the edge data is multi dimensional. 2 dimensional representation of edge data is much more compact but less 'numpy parallelizable'. So no clear way here. \n\nI use kaggle kernels for GPU . I know here there are many experienced people here.  I'm very much interested in knowing how people improve upon their neural network models in a time efficient way (with meagre resources :D ). All suggestions are much appreciated !\n\nThanks !!",
      "votes": null
    },
    {
      "id": "604486",
      "postDate": "08/21/2019 12:51:47",
      "content": "<p>Quick and dirty: train model - save weights - initialize saved weights and train further.\nIt's not really about time saving, but could help with kernel runtime limit. </p>",
      "rawMarkdown": "Quick and dirty: train model - save weights - initialize saved weights and train further.\nIt's not really about time saving, but could help with kernel runtime limit.",
      "votes": null
    },
    {
      "id": "604508",
      "postDate": "08/21/2019 13:11:58",
      "content": "<p>As an example: <code>mpnn.save_weights(\"mymodel.h5\")</code>\nand then: <code>mpnn.load_weights(\"mymodel.h5\")</code></p>",
      "rawMarkdown": "As an example: `mpnn.save_weights(\"mymodel.h5\")`\nand then: `mpnn.load_weights(\"mymodel.h5\")`",
      "votes": null
    },
    {
      "id": "604512",
      "postDate": "08/21/2019 13:18:44",
      "content": "<p>Yup. Thats what I'll do. Currently I'm trying to fit as many features as I can. Once the feature set is fixed, I'll be loading and saving weights to train it for longer period. </p>",
      "rawMarkdown": "Yup. Thats what I'll do. Currently I'm trying to fit as many features as I can. Once the feature set is fixed, I'll be loading and saving weights to train it for longer period.",
      "votes": null
    },
    {
      "id": "608287",
      "postDate": "08/26/2019 15:39:47",
      "content": "<p>What I see is that I just need to appropriately reduce the learning rate. AND give it time. Lots of time.   -2.0 LB with GNN 😁 \nEagerly waiting to see how others have got &lt; -2.5 with GNN.</p>",
      "rawMarkdown": "What I see is that I just need to appropriately reduce the learning rate. AND give it time. Lots of time.   -2.0 LB with GNN 😁 \nEagerly waiting to see how others have got &lt; -2.5 with GNN.",
      "votes": null
    },
    {
      "id": "608308",
      "postDate": "08/26/2019 15:59:56",
      "content": "<p>how long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.</p>",
      "rawMarkdown": "how long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.",
      "votes": null
    },
    {
      "id": "608344",
      "postDate": "08/26/2019 16:43:19",
      "content": "<blockquote>\n  <p>Eagerly waiting to see how others have got &lt; -2.5 with GNN.</p>\n</blockquote>\n\n<p>How do you know they use GNN?</p>",
      "rawMarkdown": "&gt; Eagerly waiting to see how others have got &lt; -2.5 with GNN.\n\nHow do you know they use GNN?",
      "votes": null
    },
    {
      "id": "608796",
      "postDate": "08/27/2019 07:11:12",
      "content": "<p><code>\nhow long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.\n</code>\n1. 5 fold CV helps a lot over a single model.\n2. 40 epoch each.</p>",
      "rawMarkdown": "```\nhow long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.\n```\n1. 5 fold CV helps a lot over a single model.\n2. 40 epoch each.",
      "votes": null
    },
    {
      "id": "608824",
      "postDate": "08/27/2019 07:33:05",
      "content": "<p><code>\nHow do you know they use GNN?\n</code> \nI think you mean <code>How do you know top-k people use GNN (k being &amp;lt; 10)</code> 😃 . I don't. However, comments like\n<a href=\"https://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228\">https://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228</a>  tells that there are some good kernels out there using GNNs.</p>\n\n<p>I'm interested in learning how to efficiently train [G]NNs. If the sole factor differentiating my work with some other better work is feature engineering, I'm not interested. On the other hand, if something is related to preprocessing, learning rate, regularization, or even something better than <code>try and see</code> method of feature engineering, or any other aspect which can be <code>transfer learnt</code> to another problem, I'm very much interested in that. </p>",
      "rawMarkdown": "```\nHow do you know they use GNN?\n``` \nI think you mean `How do you know top-k people use GNN (k being &lt; 10)` 😃 . I don't. However, comments like\nhttps://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228  tells that there are some good kernels out there using GNNs.\n\nI'm interested in learning how to efficiently train [G]NNs. If the sole factor differentiating my work with some other better work is feature engineering, I'm not interested. On the other hand, if something is related to preprocessing, learning rate, regularization, or even something better than `try and see` method of feature engineering, or any other aspect which can be `transfer learnt` to another problem, I'm very much interested in that.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 604486,
      "author_name": "stanislavblinov",
      "author_url": "",
      "post_date": "08/21/2019 12:51:47",
      "content": "<p>Quick and dirty: train model - save weights - initialize saved weights and train further.\nIt's not really about time saving, but could help with kernel runtime limit. </p>",
      "votes": null,
      "replies": [
        {
          "id": 604508,
          "author_name": "fnands",
          "author_url": "",
          "post_date": "08/21/2019 13:11:58",
          "content": "<p>As an example: <code>mpnn.save_weights(\"mymodel.h5\")</code>\nand then: <code>mpnn.load_weights(\"mymodel.h5\")</code></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 604512,
          "author_name": "silence2",
          "author_url": "",
          "post_date": "08/21/2019 13:18:44",
          "content": "<p>Yup. Thats what I'll do. Currently I'm trying to fit as many features as I can. Once the feature set is fixed, I'll be loading and saving weights to train it for longer period. </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 608287,
      "author_name": "silence2",
      "author_url": "",
      "post_date": "08/26/2019 15:39:47",
      "content": "<p>What I see is that I just need to appropriately reduce the learning rate. AND give it time. Lots of time.   -2.0 LB with GNN 😁 \nEagerly waiting to see how others have got &lt; -2.5 with GNN.</p>",
      "votes": null,
      "replies": [
        {
          "id": 608308,
          "author_name": "optimo",
          "author_url": "",
          "post_date": "08/26/2019 15:59:56",
          "content": "<p>how long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 608344,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "08/26/2019 16:43:19",
          "content": "<blockquote>\n  <p>Eagerly waiting to see how others have got &lt; -2.5 with GNN.</p>\n</blockquote>\n\n<p>How do you know they use GNN?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 608796,
          "author_name": "silence2",
          "author_url": "",
          "post_date": "08/27/2019 07:11:12",
          "content": "<p><code>\nhow long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.\n</code>\n1. 5 fold CV helps a lot over a single model.\n2. 40 epoch each.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 608824,
          "author_name": "silence2",
          "author_url": "",
          "post_date": "08/27/2019 07:33:05",
          "content": "<p><code>\nHow do you know they use GNN?\n</code> \nI think you mean <code>How do you know top-k people use GNN (k being &amp;lt; 10)</code> 😃 . I don't. However, comments like\n<a href=\"https://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228\">https://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228</a>  tells that there are some good kernels out there using GNNs.</p>\n\n<p>I'm interested in learning how to efficiently train [G]NNs. If the sole factor differentiating my work with some other better work is feature engineering, I'm not interested. On the other hand, if something is related to preprocessing, learning rate, regularization, or even something better than <code>try and see</code> method of feature engineering, or any other aspect which can be <code>transfer learnt</code> to another problem, I'm very much interested in that. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "604449": "For past 10 days or so I've been trying to get GNN working. I took GNN code from @fnands's very  very helpful kernel. https://www.kaggle.com/fnands/1-mpnn .  I'm, however, using my own features.   I'm using normalized version of the features (+one hot encoding for categorical ones) I developed for tree based Catboost model. With GNN I've reached -1.54 on my validation set. However, 5 fold group validation based Catboost model gives me -1.95 on my validation set and -2.0 on LB.\n \nI'm struggling to speed up the iteration for my GNN. In tree based models, it is relatively simpler as\n1. **Explicit feature importances** are present.: With permutation importance (https://www.kaggle.com/speedwagon/permutation-importance) I'm trying to manage this for GNN.  \n\n2. **Run time** is quite less for tree based models. Just 25 iterations of GNN takes about 8 hours ! \n\nFor run time improvement, one way could be to remove the redundant data. In @fnands implementation,  I see that 95% of edges data is just zeros. It is because the edge data is multi dimensional. 2 dimensional representation of edge data is much more compact but less 'numpy parallelizable'. So no clear way here. \n\nI use kaggle kernels for GPU . I know here there are many experienced people here.  I'm very much interested in knowing how people improve upon their neural network models in a time efficient way (with meagre resources :D ). All suggestions are much appreciated !\n\nThanks !!",
    "604486": "Quick and dirty: train model - save weights - initialize saved weights and train further.\nIt's not really about time saving, but could help with kernel runtime limit.",
    "604508": "As an example: `mpnn.save_weights(\"mymodel.h5\")`\nand then: `mpnn.load_weights(\"mymodel.h5\")`",
    "604512": "Yup. Thats what I'll do. Currently I'm trying to fit as many features as I can. Once the feature set is fixed, I'll be loading and saving weights to train it for longer period.",
    "608287": "What I see is that I just need to appropriately reduce the learning rate. AND give it time. Lots of time.   -2.0 LB with GNN 😁 \nEagerly waiting to see how others have got &lt; -2.5 with GNN.",
    "608308": "how long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.",
    "608344": "&gt; Eagerly waiting to see how others have got &lt; -2.5 with GNN.\n\nHow do you know they use GNN?",
    "608796": "```\nhow long did you train to reach -2.0LB? I have one single model at this score, trained for ~16h.\n```\n1. 5 fold CV helps a lot over a single model.\n2. 40 epoch each.",
    "608824": "```\nHow do you know they use GNN?\n``` \nI think you mean `How do you know top-k people use GNN (k being &lt; 10)` 😃 . I don't. However, comments like\nhttps://www.kaggle.com/c/champs-scalar-coupling/discussion/105088#604228  tells that there are some good kernels out there using GNNs.\n\nI'm interested in learning how to efficiently train [G]NNs. If the sole factor differentiating my work with some other better work is feature engineering, I'm not interested. On the other hand, if something is related to preprocessing, learning rate, regularization, or even something better than `try and see` method of feature engineering, or any other aspect which can be `transfer learnt` to another problem, I'm very much interested in that."
  },
  "source": "meta"
}