I am trying to check if the train data is linearly separable or not. For that I am using the following code.
try:
import os
import random
import traceback
import numpy as np
import scipy.io as sio
from scipy.optimize import linprog
os.system('cls')
dicA = sio.loadmat('A.mat')
A = dicA.get('A')
lengthA = int(len(A)/1000)
aRange = range(0,lengthA)
selectedIndexes = random.sample(aRange,lengthA)
A1 = A[selectedIndexes]
del A
b = -1*np.ones(len(A1),np.int64)
c = np.zeros(11,np.int64)
del dicA
res = linprog(c, A_ub=A1, b_ub=b, bounds=(-float('inf'), float('inf')),options={"disp": True})
print(res)
except:
print('exception')
tb = traceback.format_exc()
print(tb)
finally:
print('reached finally')
I am using the equation mentioned at this link. I get following output when I run the script.
Iteration limit reached.
fun: -0.0
message: 'Iteration limit reached.'
nit: 1000
status: 1
success: False
x: nan
reached finally
So, does the iteration limit reached means that data is not linearly separable, if not then how do I increase the limit.