728x90

normal과 randn이 헷갈려서 정리
넘파이의 랜덤 샘플링하는 함수이고, 원하는 분포를 만들 수 있습니다.
1. np.random.normal - 정규분포
- Draw random samples from a normal (Gaussian) distribution.
- Returns: ndarray or scalar
2. np.random.randn - 표준정규준포
- Return a sample (or samples) from the “standard normal” distribution.
- Returns: ndarray or float
따라서 평균이 0이고 표준편차가 1인 표준정규분포를 만들어 주기 위해선
import numpy as np
# numpy.random.normal
np.random.normal(0, 1, size)
# numpy.random.randn
np.randoom.randn(d0, d1, ..., dn) # parameters: the dimensions of the returned array728x90
'Skills > Pythons' 카테고리의 다른 글
| [macOS] Homebrew 설치 (0) | 2023.03.08 |
|---|---|
| [macOS] pip 설치 방법 (0) | 2023.03.08 |
| [Python] 프로그래머스 배열 회전 시키기 (0) | 2022.12.29 |
| [Python] Jupyter module - %load_ext autoreload %autoreload 2 (0) | 2022.12.23 |
| [Python] from __future__ import print_function (0) | 2022.12.23 |
댓글