I am trying to multiprocess the result of svm.
And I tried the following simple method.
clf = svm.SVC(C=1.0, cache_size=1000000, class_weight=None, coef0=0.0,
decision_function_shape='ovo', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False)
clf.fit(x, y)
def predict(x):
clf.predict(x)
from multiprocessing import Pool
pool= Pool(processes = 4)
setting = np.loadtxt('~/test.csv', delimiter=',')
x=setting[:,0:3]
y=setting[:,3]
x[i]
[cols,rows] = setting.shape
i = 0
while i < rows:
k = x[i]
pool.map(predict,[[k]])
print(pool.map(predict,[[k]]))
i = i+1
This code will run, but it does not seem to have the right results.
I want to return or print the predicted value.
I would be grateful if you could provide a method or code to get predicted value results.