모델 불확실성과 표본 분포

Python으로 배우는 선형 모델 입문

Jason Vestuto

Data Scientist

모집단 데이터 없음

일수 대 온도 구간의 히스토그램, 2017년 8월 일별 최고 기온

Python으로 배우는 선형 모델 입문

표본을 모집단 모델로 사용

정규화된 일수 대 온도 구간의 히스토그램 2개, 표본과 모집단 각각 표시, 두 막대 높이가 유사함

Python으로 배우는 선형 모델 입문

표본 통계량

단일 표본의 히스토그램, 일수 대 온도 구간

Python으로 배우는 선형 모델 입문

부트스트랩 리샘플링

3개의 히스토그램, 각 표본별 중심이 서로 다르게 이동되어 있으며, 일수 대 온도 구간 축에 표시됨

Python으로 배우는 선형 모델 입문

리샘플 분포

평균값의 히스토그램, 표본 수 대 평균 온도 구간 축

Python으로 배우는 선형 모델 입문

코드로 보는 부트스트랩

# Use sample as model for population
population_model = august_daily_highs_for_2017
# Simulate repeated data acquisitions by resampling the "model"
for nr in range(num_resamples):
    bootstrap_sample = np.random.choice(population_model, size=resample_size, replace=True)
    bootstrap_means[nr] = np.mean(bootstrap_sample)
# Compute the mean of the bootstrap resample distribution
estimate_temperature = np.mean(bootstrap_means)
# Compute standard deviation of the bootstrap resample distribution
estimate_uncertainty = np.std(bootstrap_means)
Python으로 배우는 선형 모델 입문

복원 추출

# Define the sample of notes
sample = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
# Replace = True, repeats are allowed
bootstrap_sample = np.random.choice(sample, size=4, replace=True)
print(bootstrap_sample)
C C F G
Python으로 배우는 선형 모델 입문

복원 추출

# Replace = False
bootstrap_sample = np.random.choice(sample, size=4, replace=False)
print(bootstrap_sample)
C G A F
# Replace = True, more lengths are allowed
bootstrap_sample = np.random.choice(sample, size=16, replace=True)
print(bootstrap_sample)
C C F G C G A E F D G B B A E C
Python으로 배우는 선형 모델 입문

연습해 봅시다!

Python으로 배우는 선형 모델 입문

Preparing Video For Download...