In [1]:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
data = [(0.01, 3, 2.786318e-01), #learning rate, depth, R^2
(0.01, 5, 3.309793e-01),
(0.01, 7,3.545946e-01),
(0.1, 3, 4.494290e-01),
(0.1, 5, 4.848307e-01),
(0.1, 7, 0.500908),
(0.05, 10, 0.508588),
(0.08, 10, 0.505968),
(0.3, 7, 0.450216),
(1, 3, 1.792066e-02),
(1,5, 1.198566e-01),
(1,7, -1.649937e-01),
(10, 3, -1.796564e+190),
(10, 5, -2.579831e+190),
(10, 7, -4.126538e+190)]
In [3]:
temp = pd.DataFrame(data)
temp[2] = temp[2].apply(lambda x: 0 if x<0 else x)
temp = temp.pivot(index=0, columns=1, values=2)
In [4]:
plt.figure()
ax = sns.heatmap(temp)
plt.xlabel('Max Depth')
plt.ylabel('Learning Rate')
plt.show()
In [ ]: