Skip to content

Instantly share code, notes, and snippets.

Avatar

Tanay Gahlot TanayGahlot

  • NIT Goa
  • Goa,India
View GitHub Profile
View gist:9622289
if path is None:
# use an intelligent guess if it's not defined
def_path = op.realpath(op.join(op.dirname(__file__),
'..', '..', 'examples'))
path=''
#path = get_config(key, def_path)
# use the same for all datasets
if not os.path.exists(path):
try:
os.mkdir(def_path)
@TanayGahlot
TanayGahlot / parallelize_sklearn_inference.py
Created Jul 20, 2018
Answer to how to parallelize inference in sklearn using Python's multiprocessing?
View parallelize_sklearn_inference.py
from multiprocessing import Process, Pool, Queue
from time import sleep
class Predictor(Process):
"""it wraps your prediction object."""
def __init__(self, args, model_filepath):
"""intialize the super class and load the model from the pickle file."""
# intialize the super class.
super(Predictor, self).__init__(args=args)