Declaring input_shape of a converted Sequence in Keras?












1














I am trying to run a neural network on text inputs. This is a binary classification. Here is my working code so far:



df = pd.read_csv(pathname, encoding = "ISO-8859-1")
df = df[['content_cleaned', 'meaningful']] #Content cleaned: text, meaningful: label

X = df['content_cleaned']
y = df['meaningful']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=21)

tokenizer = Tokenizer(num_words=100)
tokenizer.fit_on_texts(X_train)
X_train_encoded = tokenizer.texts_to_sequences(X_train)
X_test_encoded = tokenizer.texts_to_sequences(X_test)

max_len = 100
X_train = pad_sequences(X_train_encoded, maxlen=max_len)
X_test = pad_sequences(X_test_encoded, maxlen=max_len)


batch_size = 100
max_words = 100
input_dim = X_train.shape[1] # Number of features
model = Sequential()
model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))




model.add(layers.Dense(1, activation='sigmoid'))

model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])

history = model.fit(X_train, X_test,
batch_size=batch_size,
epochs=5,
verbose=1,
validation_split=0.1)


My question is two parts. First is with the input_shape when creating the layers. I am confused as to the syntax of declaring this. When running this command:



print(X_train.shape)


I am getting this shape: (3609, 100).



From my understanding, this is telling me that there are 3609 instances. From viewing other examples, my naive assumption was to use the 100 as there are 100 types (may be understanding this incorrectly) corresponding to the max_words that I initialized. I believe that I may have done the syntax incorrectly when initializing the input_shape.



The second question is with an error message when running all of this (most likely with the incorrect input_shape). The error message highlights this line of code:



 validation_split=0.1)


The error message is:



ValueError: Error when checking target: expected dense_2 to have shape (None, 1) but got array with shape (1547, 1


Am I going about this problem incorrectly? I am very new to Deep Learning.










share|improve this question





























    1














    I am trying to run a neural network on text inputs. This is a binary classification. Here is my working code so far:



    df = pd.read_csv(pathname, encoding = "ISO-8859-1")
    df = df[['content_cleaned', 'meaningful']] #Content cleaned: text, meaningful: label

    X = df['content_cleaned']
    y = df['meaningful']
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=21)

    tokenizer = Tokenizer(num_words=100)
    tokenizer.fit_on_texts(X_train)
    X_train_encoded = tokenizer.texts_to_sequences(X_train)
    X_test_encoded = tokenizer.texts_to_sequences(X_test)

    max_len = 100
    X_train = pad_sequences(X_train_encoded, maxlen=max_len)
    X_test = pad_sequences(X_test_encoded, maxlen=max_len)


    batch_size = 100
    max_words = 100
    input_dim = X_train.shape[1] # Number of features
    model = Sequential()
    model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))




    model.add(layers.Dense(1, activation='sigmoid'))

    model.compile(loss='categorical_crossentropy',
    optimizer='adam',
    metrics=['accuracy'])

    history = model.fit(X_train, X_test,
    batch_size=batch_size,
    epochs=5,
    verbose=1,
    validation_split=0.1)


    My question is two parts. First is with the input_shape when creating the layers. I am confused as to the syntax of declaring this. When running this command:



    print(X_train.shape)


    I am getting this shape: (3609, 100).



    From my understanding, this is telling me that there are 3609 instances. From viewing other examples, my naive assumption was to use the 100 as there are 100 types (may be understanding this incorrectly) corresponding to the max_words that I initialized. I believe that I may have done the syntax incorrectly when initializing the input_shape.



    The second question is with an error message when running all of this (most likely with the incorrect input_shape). The error message highlights this line of code:



     validation_split=0.1)


    The error message is:



    ValueError: Error when checking target: expected dense_2 to have shape (None, 1) but got array with shape (1547, 1


    Am I going about this problem incorrectly? I am very new to Deep Learning.










    share|improve this question



























      1












      1








      1







      I am trying to run a neural network on text inputs. This is a binary classification. Here is my working code so far:



      df = pd.read_csv(pathname, encoding = "ISO-8859-1")
      df = df[['content_cleaned', 'meaningful']] #Content cleaned: text, meaningful: label

      X = df['content_cleaned']
      y = df['meaningful']
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=21)

      tokenizer = Tokenizer(num_words=100)
      tokenizer.fit_on_texts(X_train)
      X_train_encoded = tokenizer.texts_to_sequences(X_train)
      X_test_encoded = tokenizer.texts_to_sequences(X_test)

      max_len = 100
      X_train = pad_sequences(X_train_encoded, maxlen=max_len)
      X_test = pad_sequences(X_test_encoded, maxlen=max_len)


      batch_size = 100
      max_words = 100
      input_dim = X_train.shape[1] # Number of features
      model = Sequential()
      model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))




      model.add(layers.Dense(1, activation='sigmoid'))

      model.compile(loss='categorical_crossentropy',
      optimizer='adam',
      metrics=['accuracy'])

      history = model.fit(X_train, X_test,
      batch_size=batch_size,
      epochs=5,
      verbose=1,
      validation_split=0.1)


      My question is two parts. First is with the input_shape when creating the layers. I am confused as to the syntax of declaring this. When running this command:



      print(X_train.shape)


      I am getting this shape: (3609, 100).



      From my understanding, this is telling me that there are 3609 instances. From viewing other examples, my naive assumption was to use the 100 as there are 100 types (may be understanding this incorrectly) corresponding to the max_words that I initialized. I believe that I may have done the syntax incorrectly when initializing the input_shape.



      The second question is with an error message when running all of this (most likely with the incorrect input_shape). The error message highlights this line of code:



       validation_split=0.1)


      The error message is:



      ValueError: Error when checking target: expected dense_2 to have shape (None, 1) but got array with shape (1547, 1


      Am I going about this problem incorrectly? I am very new to Deep Learning.










      share|improve this question















      I am trying to run a neural network on text inputs. This is a binary classification. Here is my working code so far:



      df = pd.read_csv(pathname, encoding = "ISO-8859-1")
      df = df[['content_cleaned', 'meaningful']] #Content cleaned: text, meaningful: label

      X = df['content_cleaned']
      y = df['meaningful']
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=21)

      tokenizer = Tokenizer(num_words=100)
      tokenizer.fit_on_texts(X_train)
      X_train_encoded = tokenizer.texts_to_sequences(X_train)
      X_test_encoded = tokenizer.texts_to_sequences(X_test)

      max_len = 100
      X_train = pad_sequences(X_train_encoded, maxlen=max_len)
      X_test = pad_sequences(X_test_encoded, maxlen=max_len)


      batch_size = 100
      max_words = 100
      input_dim = X_train.shape[1] # Number of features
      model = Sequential()
      model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))




      model.add(layers.Dense(1, activation='sigmoid'))

      model.compile(loss='categorical_crossentropy',
      optimizer='adam',
      metrics=['accuracy'])

      history = model.fit(X_train, X_test,
      batch_size=batch_size,
      epochs=5,
      verbose=1,
      validation_split=0.1)


      My question is two parts. First is with the input_shape when creating the layers. I am confused as to the syntax of declaring this. When running this command:



      print(X_train.shape)


      I am getting this shape: (3609, 100).



      From my understanding, this is telling me that there are 3609 instances. From viewing other examples, my naive assumption was to use the 100 as there are 100 types (may be understanding this incorrectly) corresponding to the max_words that I initialized. I believe that I may have done the syntax incorrectly when initializing the input_shape.



      The second question is with an error message when running all of this (most likely with the incorrect input_shape). The error message highlights this line of code:



       validation_split=0.1)


      The error message is:



      ValueError: Error when checking target: expected dense_2 to have shape (None, 1) but got array with shape (1547, 1


      Am I going about this problem incorrectly? I am very new to Deep Learning.







      python machine-learning keras neural-network nlp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked Dec 27 '18 at 16:21









      rmahesh

      30029




      30029
























          2 Answers
          2






          active

          oldest

          votes


















          1














          The input_shape argument specifies the shape of one training sample. Therefore, you need to set it to X_train.shape[1:] (i.e. ignore samples or batch axis):



          model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))


          Further, pass X_train and y_train to the fit_generator (instead of X_train_encoded and X_test_encoded).






          share|improve this answer























          • Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
            – rmahesh
            2 days ago










          • @rmahesh I have updated my answer ("Further ....").
            – today
            2 days ago










          • So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
            – rmahesh
            2 days ago










          • @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
            – today
            2 days ago










          • Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
            – rmahesh
            2 days ago



















          0














          You missed two ending parenthesis ) at the line where you defined the input of your model. Also make sure that you provide your activation function.



          Change your code as below:



          model.add(layers.Dense(10, activation='relu', input_shape=(X_train.shape[0],)))


          EDIT:



          For your last error just change your input_shape to input_shape=(X_train.shape[0],).






          share|improve this answer























          • Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
            – rmahesh
            Dec 27 '18 at 16:40










          • After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
            – rmahesh
            Dec 27 '18 at 16:50










          • I have made an edit with the up to date error!
            – rmahesh
            Dec 27 '18 at 16:52










          • @rmahesh I edited my answer.
            – Reza Behzadpour
            Dec 27 '18 at 16:58










          • Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
            – rmahesh
            Dec 27 '18 at 17:01











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53947959%2fdeclaring-input-shape-of-a-converted-sequence-in-keras%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The input_shape argument specifies the shape of one training sample. Therefore, you need to set it to X_train.shape[1:] (i.e. ignore samples or batch axis):



          model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))


          Further, pass X_train and y_train to the fit_generator (instead of X_train_encoded and X_test_encoded).






          share|improve this answer























          • Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
            – rmahesh
            2 days ago










          • @rmahesh I have updated my answer ("Further ....").
            – today
            2 days ago










          • So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
            – rmahesh
            2 days ago










          • @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
            – today
            2 days ago










          • Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
            – rmahesh
            2 days ago
















          1














          The input_shape argument specifies the shape of one training sample. Therefore, you need to set it to X_train.shape[1:] (i.e. ignore samples or batch axis):



          model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))


          Further, pass X_train and y_train to the fit_generator (instead of X_train_encoded and X_test_encoded).






          share|improve this answer























          • Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
            – rmahesh
            2 days ago










          • @rmahesh I have updated my answer ("Further ....").
            – today
            2 days ago










          • So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
            – rmahesh
            2 days ago










          • @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
            – today
            2 days ago










          • Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
            – rmahesh
            2 days ago














          1












          1








          1






          The input_shape argument specifies the shape of one training sample. Therefore, you need to set it to X_train.shape[1:] (i.e. ignore samples or batch axis):



          model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))


          Further, pass X_train and y_train to the fit_generator (instead of X_train_encoded and X_test_encoded).






          share|improve this answer














          The input_shape argument specifies the shape of one training sample. Therefore, you need to set it to X_train.shape[1:] (i.e. ignore samples or batch axis):



          model.add(layers.Dense(10, activation='relu', input_shape=X_train.shape[1:]))


          Further, pass X_train and y_train to the fit_generator (instead of X_train_encoded and X_test_encoded).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered 2 days ago









          today

          9,84121535




          9,84121535












          • Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
            – rmahesh
            2 days ago










          • @rmahesh I have updated my answer ("Further ....").
            – today
            2 days ago










          • So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
            – rmahesh
            2 days ago










          • @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
            – today
            2 days ago










          • Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
            – rmahesh
            2 days ago


















          • Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
            – rmahesh
            2 days ago










          • @rmahesh I have updated my answer ("Further ....").
            – today
            2 days ago










          • So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
            – rmahesh
            2 days ago










          • @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
            – today
            2 days ago










          • Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
            – rmahesh
            2 days ago
















          Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
          – rmahesh
          2 days ago




          Thanks for the response. Just ran this and it still highlights the same variable declared as "history". When highlighting that, it says points at the exact same line of code with the error which I have included in my last update to the original question.
          – rmahesh
          2 days ago












          @rmahesh I have updated my answer ("Further ....").
          – today
          2 days ago




          @rmahesh I have updated my answer ("Further ....").
          – today
          2 days ago












          So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
          – rmahesh
          2 days ago




          So instead of running tokenizer.text_to_sequences, I do tokenizer.fit_generator?
          – rmahesh
          2 days ago












          @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
          – today
          2 days ago




          @rmahesh No! I am referring to the fact that you are assigning the result of padding to X_train but instead you are using X_train_encoded in model.fit_generator. That's the problem.
          – today
          2 days ago












          Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
          – rmahesh
          2 days ago




          Thanks for the response back. Please bear with me as I am trying to understand how to fix this error. I had the understanding that after splitting into train/test etc, you first convert the text to sequences, and then pad the sequences. In terms of variables, I first converted it to sequences, and stored results to “_encoded”. When doing the padding of sequences, I did this operation on “_encoded” and reassigned it to “X_train” etc. Should I have done this differently?
          – rmahesh
          2 days ago













          0














          You missed two ending parenthesis ) at the line where you defined the input of your model. Also make sure that you provide your activation function.



          Change your code as below:



          model.add(layers.Dense(10, activation='relu', input_shape=(X_train.shape[0],)))


          EDIT:



          For your last error just change your input_shape to input_shape=(X_train.shape[0],).






          share|improve this answer























          • Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
            – rmahesh
            Dec 27 '18 at 16:40










          • After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
            – rmahesh
            Dec 27 '18 at 16:50










          • I have made an edit with the up to date error!
            – rmahesh
            Dec 27 '18 at 16:52










          • @rmahesh I edited my answer.
            – Reza Behzadpour
            Dec 27 '18 at 16:58










          • Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
            – rmahesh
            Dec 27 '18 at 17:01
















          0














          You missed two ending parenthesis ) at the line where you defined the input of your model. Also make sure that you provide your activation function.



          Change your code as below:



          model.add(layers.Dense(10, activation='relu', input_shape=(X_train.shape[0],)))


          EDIT:



          For your last error just change your input_shape to input_shape=(X_train.shape[0],).






          share|improve this answer























          • Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
            – rmahesh
            Dec 27 '18 at 16:40










          • After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
            – rmahesh
            Dec 27 '18 at 16:50










          • I have made an edit with the up to date error!
            – rmahesh
            Dec 27 '18 at 16:52










          • @rmahesh I edited my answer.
            – Reza Behzadpour
            Dec 27 '18 at 16:58










          • Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
            – rmahesh
            Dec 27 '18 at 17:01














          0












          0








          0






          You missed two ending parenthesis ) at the line where you defined the input of your model. Also make sure that you provide your activation function.



          Change your code as below:



          model.add(layers.Dense(10, activation='relu', input_shape=(X_train.shape[0],)))


          EDIT:



          For your last error just change your input_shape to input_shape=(X_train.shape[0],).






          share|improve this answer














          You missed two ending parenthesis ) at the line where you defined the input of your model. Also make sure that you provide your activation function.



          Change your code as below:



          model.add(layers.Dense(10, activation='relu', input_shape=(X_train.shape[0],)))


          EDIT:



          For your last error just change your input_shape to input_shape=(X_train.shape[0],).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 27 '18 at 16:57

























          answered Dec 27 '18 at 16:37









          Reza Behzadpour

          31116




          31116












          • Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
            – rmahesh
            Dec 27 '18 at 16:40










          • After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
            – rmahesh
            Dec 27 '18 at 16:50










          • I have made an edit with the up to date error!
            – rmahesh
            Dec 27 '18 at 16:52










          • @rmahesh I edited my answer.
            – Reza Behzadpour
            Dec 27 '18 at 16:58










          • Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
            – rmahesh
            Dec 27 '18 at 17:01


















          • Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
            – rmahesh
            Dec 27 '18 at 16:40










          • After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
            – rmahesh
            Dec 27 '18 at 16:50










          • I have made an edit with the up to date error!
            – rmahesh
            Dec 27 '18 at 16:52










          • @rmahesh I edited my answer.
            – Reza Behzadpour
            Dec 27 '18 at 16:58










          • Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
            – rmahesh
            Dec 27 '18 at 17:01
















          Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
          – rmahesh
          Dec 27 '18 at 16:40




          Thank you for the response. Unfortunately, the exact same error is present when including that parenthesis.
          – rmahesh
          Dec 27 '18 at 16:40












          After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
          – rmahesh
          Dec 27 '18 at 16:50




          After adding that extra bracket, I am faced with the following error code (which was why I was confident it had to do with the input_shape): "ValueError: Error when checking input: expected dense_1_input to have shape (None, 100) but got array with shape (3609, 1)"
          – rmahesh
          Dec 27 '18 at 16:50












          I have made an edit with the up to date error!
          – rmahesh
          Dec 27 '18 at 16:52




          I have made an edit with the up to date error!
          – rmahesh
          Dec 27 '18 at 16:52












          @rmahesh I edited my answer.
          – Reza Behzadpour
          Dec 27 '18 at 16:58




          @rmahesh I edited my answer.
          – Reza Behzadpour
          Dec 27 '18 at 16:58












          Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
          – rmahesh
          Dec 27 '18 at 17:01




          Edited with the latest error from the same code. It keeps highlighting the same thing with "validation_split=0.1)". Did I declare that wrong or something?
          – rmahesh
          Dec 27 '18 at 17:01


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53947959%2fdeclaring-input-shape-of-a-converted-sequence-in-keras%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'