Skip to content

Instantly share code, notes, and snippets.


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 = get_config(key, def_path)
# use the same for all datasets
if not os.path.exists(path):
TanayGahlot /
Created Jul 20, 2018
Answer to how to parallelize inference in sklearn using Python's multiprocessing?
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)