title: How to save deep super learner graphs?
body: <p>I am trying to run a deep super learning package (<a href="https://github.com/levyben/DeepSuperLearner" rel="nofollow noreferrer">https://github.com/levyben/DeepSuperLearner</a>) which gives 2 graphs but does not  show how to save them - from this code is there anything I can add to save the graphs?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>if __name__ == '__main__':
      MLP_learner = dcv.GridSearchCV(mlp, parameter_space, cv=inner_cv,iid=False, n_jobs=-1)
      GBM_learner = dcv.GridSearchCV(gbm, param, cv=inner_cv,iid=False, n_jobs=-1)
      LR_learner = dcv.GridSearchCV(logreg, LR_par, cv=inner_cv, iid=False, n_jobs=-1)
      RFC_learner = dcv.GridSearchCV(rfc, param_grid, cv=inner_cv,iid=False, n_jobs=-1)
      SVM_learner =  dcv.GridSearchCV(svm, tuned_parameters, cv=inner_cv, iid=False, n_jobs=-1)
      Keras_learner = GridSearchCV(estimator=keras, param_grid=kerasparams, cv=inner_cv,iid=False, n_jobs=-1)
      Base_learners = {'MultilayerPerceptron':MLP_learner, 'GradientBoostingMachine':GBM_learner, 
          'LogisticRegression':LR_learner,'RandomForest':RF_learner, 'SupportVectorMachine':SVM_learner, 'Keras':Keras_learner}
  
      X_train, X_test, Y_train, Y_test = train_test_split(X_res, y_res, test_size=0.2, random_state=0)
  
      DSL_learner = DeepSuperLearner(Base_learners)
      DSL_learner.fit(X_train, Y_train,max_iterations=1,sample_weight=None)
      DSL_learner.get_precision_recall(X_test, Y_test, show_graphs=True) 
      y_pred = DSL_learner.predict(X_test)
      y_pred = numpy.argmax(y_pred,axis=1) 
      print("Deep Super Learner Test Accuracy:", accuracy_score(y_pred, Y_test)*100, "%")
  
  </code></pre>
  
  <p>I assume it's the 'show_graphs=True' giving me the graphs but I need to be able to save these outputs, from reading the documentation in the github they do not give that option to add into the .get_precision_recall()  function. I have been trying to apply matplotlib's savefig() but with no success so far.</p>
  
  <p>I have tried adding:</p>
  
  <pre><code>    plot = DSL_learner.get_precision_recall(X_test, Y_test, show_graphs=True)
      plt.show(plot)
      plot.savefig('DeepSuperLearner.png')
  </code></pre>
  
  <p>but this gives the error:
  <code>AttributeError: 'tuple' object has no attribute 'savefig'</code></p>
  
  <p>Here is the image I get (ran quickly with less models for speed just to show) and that I am trying to save:
  <img src="https://imgur.com/CihIQ4l" alt="graphs"></p>
  
  <p>These are also the same as what is in the example of the github.
  Also when I run:</p>
  
  <pre><code>  plot = DSL_learner.get_precision_recall(X_test, Y_test, show_graphs=True)
    plt.show(plot)
  </code></pre>
  
  <p>the graph image outputs a 2nd time. I am running this in jupyter lab (however need to be able to save the graphs to run this code elsewhere and still get the graphs)</p>