title: Keras model.summary() object to string
body: <p>I want to write a *.txt file with the neural network hyperparameters and the model architecture. Is it possible to write the object model.summary() to my output file?</p>
  
  <pre><code>(...)
  summary = str(model.summary())
  (...)
  out = open(filename + 'report.txt','w')
  out.write(summary)
  out.close
  </code></pre>
  
  <p>It happens that I'm getting "None" as you can see below.</p>
  
  <pre><code>Hyperparameters
  =========================
  
  learning_rate: 0.01
  momentum: 0.8
  decay: 0.0
  batch size: 128
  no. epochs: 3
  dropout: 0.5
  -------------------------
  
  None
  val_acc: 0.232323229313
  val_loss: 3.88496732712
  train_acc: 0.0965207634216
  train_loss: 4.07161939425
  train/val loss ratio: 1.04804469418
  </code></pre>
  
  <p>Any idea how to deal with that?</p>