matplotlib
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| matplotlib [2020/01/29 11:11] – [MAP-Elite archive] rex8312 | matplotlib [2024/03/23 02:38] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 3: | 줄 3: | ||
| ===== Animation ===== | ===== Animation ===== | ||
| - | | + | |
| + | * [[https:// | ||
| 줄 76: | 줄 77: | ||
| * https:// | * https:// | ||
| - | ====== imshow | + | ===== imshow ===== |
| <code python> | <code python> | ||
| 줄 92: | 줄 93: | ||
| else: | else: | ||
| c = (1 - min_diff) * w | c = (1 - min_diff) * w | ||
| + | c = np.clip(c, 0, 1) | ||
| cs.append(c) | cs.append(c) | ||
| ax1.text(0, | ax1.text(0, | ||
| 줄 105: | 줄 107: | ||
| ===== Radar chart ===== | ===== Radar chart ===== | ||
| + | |||
| + | * https:// | ||
| <code python> | <code python> | ||
| 줄 122: | 줄 126: | ||
| </ | </ | ||
| - | ====== Subplot | + | ===== Subplot ===== |
| * https:// | * https:// | ||
| - | ====== Embedded plot ====== | + | ===== Embedded plot ===== |
| <code python> | <code python> | ||
| 줄 167: | 줄 171: | ||
| </ | </ | ||
| - | ===== MAP-Elite archive ==== | ||
| - | <code python> | ||
| - | behavior_description = np.random.randint(0, | ||
| - | quality = np.random.random(20) | ||
| - | map_size | + | ===== Neural Net Weights/ |
| - | height_size = 1 | + | * [[https:// |
| - | width_size = 1 | + | |
| - | height_idx = [] | + | |
| - | width_idx = [] | + | |
| - | for idx, s in enumerate(map_size): | + | |
| - | if height_size > width_size: | + | |
| - | width_idx.append(idx) | + | |
| - | width_size *= s | + | |
| - | else: | + | |
| - | height_idx.append(idx) | + | |
| - | height_size *= s | + | |
| - | height_ticks = map_size[height_idx] | ||
| - | height = np.product(height_ticks) | ||
| - | width_ticks = map_size[width_idx] | ||
| - | width = np.product(width_ticks) | ||
| - | bd_map = np.zeros((height, | ||
| - | |||
| - | | ||
| - | |||
| - | for bd_idx, qv in zip(bd_idxs, | ||
| - | y = 0 | ||
| - | for i, hi in enumerate(bd_idx[height_idx]): | ||
| - | y += hi * np.product(height_ticks[i+1: | ||
| - | x = 0 | ||
| - | for i, wi in enumerate(bd_idx[width_idx]): | ||
| - | x += wi * np.product(width_ticks[i+1: | ||
| - | bd_map[y][x] = qv | ||
| - | |||
| - | fig = plt.figure() | ||
| - | ax = fig.add_subplot(111) | ||
| - | ax.set_xticklabels([]) | ||
| - | ax.set_yticklabels([]) | ||
| - | n_solutions = len(quality) | ||
| - | search_space_size = np.product(bd_map.shape) | ||
| - | ax.set_xlabel(f' | ||
| - | im = ax.imshow(bd_map, | ||
| - | fig.colorbar(im) | ||
| - | plt.show() | ||
| - | plt.close() | ||
| - | </ | ||
matplotlib.1580296282.txt.gz · 마지막으로 수정됨: (바깥 편집)