title: Not able to check linear separability of data in python
body: <p>I have a training data set. I want to check if that is linearly separable. I am using linear programming for this purpose and using the equations mentioned at this <a href="https://www.joyofdata.de/blog/testing-linear-separability-linear-programming-r-glpk/" rel="nofollow noreferrer">site</a>. The data has 11 columns, with last column(11th) having values(0,1) representing result values. Below is the code that I am using:</p>
  
  <pre><code>    import os
      import math
      import traceback
      import numpy as np
      import scipy.io as sio
      from scipy.optimize import linprog
      os.system('cls')
      dic  = sio.loadmat('train.mat')
      M = dic.get('M')
      #s0 = np.zeros((1,11),np.int64)
      #s1 = np.zeros((1,11),np.int64)
      if M!=None:
          print(len(M))
          print(len(M[0]))
          m0 = M[M[:,10]==0]
          m1 = M[M[:,10]==1]
          m0 = m0[:,0:10]
          m1 = m1[:,0:10]
          m0 = -1*m0
          o0 = np.ones((len(m0),1),np.int64)
          m0 = np.hstack((m0,o0))
          o1 = -1*np.ones((len(m1),1),np.int64)
          m1 = np.hstack((m1,o1))
          del M
          del dic
          print('del variables')
          A = np.vstack((m1,m0))
          print(A)
          b = -1*np.ones((len(A),1),np.int64)
          print(b)
          c = np.zeros((1,11),np.int64)                     
          print('size c =[',len(c),',',len(c[0]),']')
          print('size A =[',len(A),',',len(A[0]),']')
          print('size b =[',len(b),',',len(b[0]),']')
          res = linprog(c, A_ub=A, b_ub=b, bounds=(-math.inf, math.inf),options={"disp": True})
          print(res)
  </code></pre>
  
  <p>I get the following error when I run the above code.</p>
  
  <pre><code>res = linprog(c, A_ub=A, b_ub=b, bounds=(-math.inf, math.inf),options={"disp": True})
    File "E:\Python\lib\site-packages\scipy\optimize\_linprog.py", line 993, in linprog
      bounds=bounds, callback=callback, **options)
    File "E:\Python\lib\site-packages\scipy\optimize\_linprog.py", line 594, in _linprog_simplex
      cc = np.concatenate([np.array([0]), cc])
  ValueError: all the input arrays must have same number of dimensions
  </code></pre>
  
  <p>So, as stated in the exception, I am setting wrong value of arrays.From what I have understood, c is the seed value for finding the hyper plane and b is R.H.S of equation.So, what am I doing wrong?</p>