scikit-learn/scikit-learn — pull request #1857 by ihaque (2013-04-14 00:45:41+00:00)
Title: Release GIL for time-consuming operations in libsvm

Currently, training an SVM model or using one to make predictions locks up the interpreter thread while libsvm chugs along in C.

This patch releases the GIL around the time consuming operations `svm_train`, `svm_predict`, `svm_predict_values`, and `svm_predict_probability`. (The latter three are wrapped in libsvm_helper; I release the GIL around the wrapper function.)

This allows Python code to continue running; in my particular case, it lets me maintain a GUI in a main thread, run sklearn code in a compute thread, and still have a responsive UI. Without the patch the UI blocks waiting for libsvm operations to run. (It also would let you parallelize libsvm across `Thread`s, but that's not the main point here.)