{
  "id": 372887,
  "title": "why can't predict data using multi input keras mode",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/372887",
  "author_name": "Arkadeb Misra",
  "post_date": "2022-12-18T14:34:06.300000",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I have created this mode and trained it just 1 epoch. but cant understand how I should pass data to the model to predict</p>\n<p>here is the notebook <a href=\"https://www.kaggle.com/code/arkadebmisra/rsna-mammography\" target=\"_blank\">notebook</a></p>\n<p>the problem is say two inputs are x and y</p>\n<p>** x and y are arrays of data what goes to input1 ond input 2 of the model</p>\n<p>I have tried </p>\n<p>model.predict([x, y])</p>\n<p>and<br>\nz = [(x, y)]</p>\n<p>model.predict(z)</p>\n<p>nothing works.<br>\nplease help</p>",
  "messages": [
    {
      "id": 2069057,
      "postDate": "2022-12-18T14:34:06.300Z",
      "content": "<p>I have created this mode and trained it just 1 epoch. but cant understand how I should pass data to the model to predict</p>\n<p>here is the notebook <a href=\"https://www.kaggle.com/code/arkadebmisra/rsna-mammography\" target=\"_blank\">notebook</a></p>\n<p>the problem is say two inputs are x and y</p>\n<p>** x and y are arrays of data what goes to input1 ond input 2 of the model</p>\n<p>I have tried </p>\n<p>model.predict([x, y])</p>\n<p>and<br>\nz = [(x, y)]</p>\n<p>model.predict(z)</p>\n<p>nothing works.<br>\nplease help</p>",
      "rawMarkdown": "I have created this mode and trained it just 1 epoch. but cant understand how I should pass data to the model to predict\n\nhere is the notebook [notebook](https://www.kaggle.com/code/arkadebmisra/rsna-mammography)\n\nthe problem is say two inputs are x and y\n\n** x and y are arrays of data what goes to input1 ond input 2 of the model\n\nI have tried \n\nmodel.predict([x, y])\n\nand\nz = [(x, y)]\n\nmodel.predict(z)\n\nnothing works.\nplease help",
      "votes": 1
    },
    {
      "id": 2071009,
      "postDate": "2022-12-20T14:34:42.693Z",
      "content": "<p>I am working on something similar so I will try my best. Apologies in advance if it is a dead end. :-)<br>\nmodel.predict([x, y]) should be correct. I think it would be better to name it X1 and X2 though since y to me indicates the labels. <br>\nI guess you know already since you made the notebook but X1 should be the array with the attributes and X2 the array binary image data (3 values per row in first array and 256x256 values per row for the images). From the error you are getting I would assume that you have mixed up the input so that you are inputting 3x256 rather than 3 and 256x256 in two separate arrays.</p>",
      "rawMarkdown": "I am working on something similar so I will try my best. Apologies in advance if it is a dead end. :-)\nmodel.predict([x, y]) should be correct. I think it would be better to name it X1 and X2 though since y to me indicates the labels. \nI guess you know already since you made the notebook but X1 should be the array with the attributes and X2 the array binary image data (3 values per row in first array and 256x256 values per row for the images). From the error you are getting I would assume that you have mixed up the input so that you are inputting 3x256 rather than 3 and 256x256 in two separate arrays.",
      "replies": [
        {
          "id": 2071105,
          "postDate": "2022-12-20T16:16:01.290Z",
          "content": "<p>Thank you for your help. It works now. This time I created empty numpy array and assigned the images read from the directory instead of just appending them in a python list.</p>",
          "rawMarkdown": "Thank you for your help. It works now. This time I created empty numpy array and assigned the images read from the directory instead of just appending them in a python list.",
          "replies": [
            {
              "id": 2071167,
              "postDate": "2022-12-20T17:49:06.940Z",
              "content": "<p>Cool. Glad you got it to work.</p>",
              "rawMarkdown": "Cool. Glad you got it to work."
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2071009,
      "author_name": "lmadsen",
      "author_url": "",
      "post_date": "2022-12-20T14:34:42.693000",
      "content": "<p>I am working on something similar so I will try my best. Apologies in advance if it is a dead end. :-)<br>\nmodel.predict([x, y]) should be correct. I think it would be better to name it X1 and X2 though since y to me indicates the labels. <br>\nI guess you know already since you made the notebook but X1 should be the array with the attributes and X2 the array binary image data (3 values per row in first array and 256x256 values per row for the images). From the error you are getting I would assume that you have mixed up the input so that you are inputting 3x256 rather than 3 and 256x256 in two separate arrays.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2071105,
          "author_name": "Arkadeb Misra",
          "author_url": "",
          "post_date": "2022-12-20T16:16:01.290000",
          "content": "<p>Thank you for your help. It works now. This time I created empty numpy array and assigned the images read from the directory instead of just appending them in a python list.</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2071167,
              "author_name": "lmadsen",
              "author_url": "",
              "post_date": "2022-12-20T17:49:06.940000",
              "content": "<p>Cool. Glad you got it to work.</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2069057": "I have created this mode and trained it just 1 epoch. but cant understand how I should pass data to the model to predict\n\nhere is the notebook [notebook](https://www.kaggle.com/code/arkadebmisra/rsna-mammography)\n\nthe problem is say two inputs are x and y\n\n** x and y are arrays of data what goes to input1 ond input 2 of the model\n\nI have tried \n\nmodel.predict([x, y])\n\nand\nz = [(x, y)]\n\nmodel.predict(z)\n\nnothing works.\nplease help",
    "2071009": "I am working on something similar so I will try my best. Apologies in advance if it is a dead end. :-)\nmodel.predict([x, y]) should be correct. I think it would be better to name it X1 and X2 though since y to me indicates the labels. \nI guess you know already since you made the notebook but X1 should be the array with the attributes and X2 the array binary image data (3 values per row in first array and 256x256 values per row for the images). From the error you are getting I would assume that you have mixed up the input so that you are inputting 3x256 rather than 3 and 256x256 in two separate arrays."
  }
}