Figure 5 - Runtime


In [1]:
import matplotlib.pyplot as pl

# timing data from separate runs
brute_force = [0.000547, 0.007596, 0.01731, 0.050687, 0.317647, 0.471027, 1.491240, 3.9685, 12.283, 40.28, 96.3355, 315.67518]
fast_method = [0.000094, 0.000108, 0.000080, 0.000121, 0.000222, 0.000382, 0.000910, 0.00124, 0.0015, 0.0034, 0.00335, 0.00577]

# plotting
fig = pl.figure(figsize=(4.5,2.5))
pl.semilogy(fast_method, color='#1E88E5', linewidth=2)
pl.semilogy(brute_force, color='#7C52FF', linewidth=2)
pl.ylabel("seconds of runtime")
pl.xlabel("number of input features and max tree depth")
pl.legend(["TreeSHAP", "Brute force"], frameon=False, loc="upper left")
#plt.savefig("runtime.pdf")
pl.show()