참고 링크 : https://numpy.org/doc/stable/reference/random/generated/numpy.random.normal.html
무작위 표존 추출
random.normal(loc=0.0, scale=1.0, size=None)
Draw random samples from a normal (Gaussian) distribution.
Parameters:
(평균)loc : float or array_like of floats : Mean (“centre”) of the distribution.
(표준편차)scale : float or array_like of floats : Standard deviation (spread or “width”) of the distribution. Must be non-negative.
(데이터 개수)size : int or tuple of ints, optional : Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned if loc and scale are both scalars. Otherwise, np.broadcast(loc, scale).size samples are drawn.
Returns : out : ndarray or scalar
Drawn samples from the parameterized normal distribution.
matplot 사용 예시
n_data = 100
s_idx = 30
x_data = np.arange(s_idx, s_idx + n_data)
y_data = np.random.normal(0, 1, (n_data,))
fig, ax = plt.subplots(figsize=figsize)
ax.plot(x_data, y_data)
fig.tight_layout(pad=1) #pad : Padding between the figure edge and the edges of subplots. 여백
x_ticks = \
np.arange(s_idx, s_idx + n_data + 1, step=29)
ax.set_xticks(x_ticks)
ax.tick_params(labelsize=15)
ax.grid()
plt.show()
'개발 > AI' 카테고리의 다른 글
[Python] GBL : Gradient-based Learning (1) | 2023.11.13 |
---|---|
[Python] Backpropagation (1) | 2023.11.13 |
[Python] Logic Gate 클래스 만들기 (0) | 2023.11.07 |
[Python] Logic Gate 함수 구현 연습 (1) | 2023.11.06 |
[AutoViz] EDA를 도와줄 시각화 툴 (1) | 2023.10.31 |