def build_forest(self):
forest = {}
for t in range(self.f_size):
forest[t] = Tree(self, rho=self.rho)
forest[t].tree_leaf_plots(fname='tree_opt%s.png'%t)
path = os.getcwd() + '/plots/'
mkdir_p(path)
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111)
color = ['lightcoral', 'dodgerblue', 'mediumseagreen', 'darkorange']
for t in range(self.f_size):
for c, n in enumerate(forest[t].leaf_nodes):
[[i1, i2], [j1, j2]] = n.quad
x1, x2 = self.grid[0][i1], self.grid[0][i2]
y1, y2 = self.grid[1][j1], self.grid[1][j2]
ax.fill_between([x1,x2], y1, y2, alpha=.15, color=color[c])
pd.DataFrame(self.data, columns=['x', 'y']).plot(ax=ax, x='x', y='y', kind='scatter', lw=0, alpha=.6, s=20, c='k')
plt.savefig(path + 'combined.png', format='png')
plt.close()
return forest
# Implement Online L-curve optimization like EWMA to get rid of input depth
density_forest.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录