Closed anaderi closed 8 years ago
it is useful if jupyter frontend disconnects during fit/predict execution.
might the following snippet be handy for such cases
class Stopwatch(object): def __enter__(self): self.t0 = datetime.datetime.now() return self def __exit__(self, type, value, traceback): self.t1 = datetime.datetime.now() def __repr__(self): return "delta: (%s)" % (self.t1 - self.t0) with Stopwatch() as sfit: time.sleep(1) with Stopwatch() as spredict: time.sleep(1) print "fit:", sfit, "spredict:", spredict
We can add this into utils (I'm using time.time()). It's actually a shame that in 2016 none of standard python modules have some similar class.
done in https://github.com/yandex/rep/commit/004b1dcc6ccdd5adf27c9817a1ce0d1ed43deadb
it is useful if jupyter frontend disconnects during fit/predict execution.
might the following snippet be handy for such cases