title: LSTM Data Cardinality ambiguous issue regarding number of samples
body: <blockquote>
  <p>My attempt at solving: Previously I had: ValueError: cannot reshape array of size 8244 into shape (5,1) for my LSTM model which then I changed xtrain shape to <em>reshape(-1,1374,1)</em>.</p>
  </blockquote>
  <p>|Column | Count | Dtype |
  |:---- |:------:| -----:|
  | somedata  | 1718    | Float64 |
  | somedata  | 1718    | Float64 |
  | somedata  | 1718    | Float64 |
  | somedata  | 1718    | Float64 |
  <code>ValueError: Data cardinality is ambiguous: x sizes: 1 y sizes: 1374 Make sure all arrays contain the same number of samples.</code></p>
  <pre><code>new.shape &lt;- (1718,7)
  
  # create the variables for prediction and split into training and test sets
  
  y = np.log(new['Close'].astype(int)) # we want to predict the adjusted close price
  X = new.drop('Close', axis=1) # predictive variables (removing Adj close from it)
  
  #split the data into training and test sets
  xtrain, xtest, ytrain, ytest = train_test_split(X, y, test_size=0.20, random_state=42)
  
  # Build the LSTM model
  model2 = Sequential()
  model2.add(LSTM(128, return_sequences=True, input_shape= (xtrain.shape[1], 1)))
  model2.add(LSTM(64, return_sequences=False))
  model2.add(Dense(25))
  model2.add(Dense(1))
  # view model summary
  model2.summary()
  # Compile the model
  model2.compile(optimizer='adam', loss='mean_squared_error')
  xtrain.shape &lt;-(1374,6)
  #predictions 
  predictions2 = model2.predict(np.array(xtest).reshape(-1,5,1))
  </code></pre>