title: Seaborn distplot "numpy.linalg.LinAlgError: singular matrix"
body: <p>I am using Pycharm to run a Machine learning interface code. The SVM algorithm keeps crashing my interface with the following error:</p>
  <pre><code>line 1220, in pushButton_8_handlerax1 = sns.distplot(Y_predict)
  line 979, in invraise LinAlgError(&quot;singular matrix&quot;)
  numpy.linalg.LinAlgError: singular matrix
  </code></pre>
  <p>The code is below.</p>
  <pre class="lang-py prettyprint-override"><code>from sklearn import model_selection
  from sklearn.model_selection import train_test_split
  from sklearn.model_selection import cross_val_score
  from sklearn.linear_model import LogisticRegression
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from sklearn.naive_bayes import GaussianNB
  from sklearn.svm import SVC
  from sklearn.preprocessing import LabelEncoder
  from sklearn import tree
  from sklearn.metrics import accuracy_score
  import pickle
  from PIL import Image
  import numpy as np
  import seaborn as sns
  
  
  def plot_distribution(inp):
      plt.figure()
      ax = sns.distplot(inp)
      plt.axvline(np.mean(inp), color=&quot;k&quot;, linestyle=&quot;dashed&quot;, linewidth=5)
      _, max_ = plt.ylim()
      plt.text(
          inp.mean() + inp.mean() / 10,
          max_ - max_ / 10,
          &quot;Mean: {:.2f}&quot;.format(inp.mean()),
      )
      return plt.figure
  
  print(np.mean(Y_test))
  print(np.mean(Y_predict))
  
  # ________________________Dist Predict Vs. Test and Means value_________________________
  plt.figure(figsize=(9, 5))
  o = np.mean(Y_test)
  tt = np.mean(Y_train)
  ax1 = sns.distplot(Y_predict)
  ax2 = sns.distplot(Y_test)
  RR1 = ('Mean:', tt)
  RR2 = ('Mean:', o)
  plt.axvline(np.mean(Y_predict), color='b', linestyle='dashed', linewidth=5, label=RR1)
  plt.axvline(np.mean(Y_test), color='orange', linestyle='dashed', linewidth=5, label=RR2)
  plt.legend()
  plt.savefig('DecisionTreeClassifier2.png')
  </code></pre>
  <p>basically, the error is at <code>ax1 = sns.distplot(Y_predict)</code>.</p>
  <p>I hope I was able to explain the problem.</p>
  <p>Thanks</p>