gist:9994217 (original) (raw)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

import multiprocessing
from sklearn.linear_model import LogisticRegression
import numpy as np
import math
def func(iterator):
function = LogisticRegression()
function.fit(np.random.randn(88, 110), np.random.rand(88) < .1)
return function
tasks = [1,2,3]
pool = multiprocessing.Pool(1)
results = pool.imap(func, tasks)
for results in results:
print("function executed succesfully")
pool.close()
pool.join()