title: Training a model by looping through the train_test_split and training without looping
body: <p>I am new to python and Keras please bear with my question.</p>
  
  <ol>
  <li><p>I recently created a model in Keras, trained it and got the 'mean square error MSE' post prediction. I used the train_test_split function on the data set used.</p></li>
  <li><p>Next I created a while loop with 50 iterations and applied it to the above said model. However I kept the train_test_split function (*random_number not specified) within the loop such that in every iteration I would have a new set of X_train, y_train, X_test and y_test values. I obtained 50 MSE values as output and calculated their 'mean' and 'standard' deviation'. 
  My query was did I do the right thing by placing the train_test_split function within the loop? Does it effect my goal which was to see the different MSE values generated for my data set?</p></li>
  <li><p>If I had placed the train_test_split function outside my while loop and performed the above said activity, wouldn't the X_train, y_train, X_test and y_test values remain the same through out all of my 50 iterations? Wouldn't this cause an over fitting problem to my model?</p></li>
  </ol>
  
  <p>I would really appreciate your feedback.</p>
  
  <p>My code snippet:</p>
  
  <pre><code>from sklearn.model_selection import train_test_split
  from sklearn import metrics
  import numpy as np
  
  MSE=np.zeros(50)
  
  for i in range(50):
      predictors_train,predictors_test,target_train,target_test=train_test_split(predictors,target,test_size=0.3)
      model=regression_model()
      model.fit(predictors_train,target_train,validation_data=(predictors_test,target_test),epochs=50,verbose=0)
      model.evaluate(predictors_test,target_test, verbose=0)
      target_predicted=model.predict(predictors_test)
      MSE[i]=metrics.mean_squared_error(target_test, target_predicted)
      print("Test set MSE for {} cycle:{}".format(i+1,MSE[i]))
  </code></pre>