def profiling()

in fast_grad/helpers.py [0:0]


def profiling(full, names, approximations, model, X, y, REPEATS=1, Prec=20):
	print("Profiling")

	def profile(method):
		pr = cProfile.Profile()
		pr.enable()
		for r in range(REPEATS):
			method(model, X, y)
		pr.disable()
		pr.create_stats()
		ps = pstats.Stats(pr).sort_stats("cumulative")
		ps.print_stats(Prec)

	print("Full:")
	profile(full)
	for i in range(len(approximations)):
		print(names[i])
		profile(approximations[i])