Last active
December 24, 2017 05:24
-
-
Save orleika/365108da63745f6315c17d830d109bc1 to your computer and use it in GitHub Desktop.
DFS(枝刈り込み)による統計的識別手法の最良組み合わせ抽出
To reduce total processing time by using multiprocessing
import multiprocessing as mp
def roc(v):
""" calculate one pair, return (index, auc) """
i, true, pred = v
fpr, tpr, thresholds = metrics.roc_curve(true, pred, drop_intermediate=True)
auc = metrics.auc(fpr, tpr)
return i, auc
pool = mp.Pool(3)
result = pool.map_async(roc, ((i, true[i], pred[i]) for i in range(2)))
pool.close()
pool.join()
print result.get()
Python is not supported tail call optimization, therforer, recursive call function should transform loop function.
my god!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Timer unit: 1e-06 s
Total time: 0.007946 s
File:
Function: auc at line 1
Line # Hits Time Per Hit % Time Line Contents