MLE for Gaussian Distribution

Xem dạng PDF

Gửi bài giải

Điểm: 100,00
Giới hạn thời gian: 2.0s
Giới hạn bộ nhớ: 256M

Tác giả:
Dạng bài
Ngôn ngữ cho phép
Python

Problem Statement

Given n observations from a 1D Gaussian distribution, compute the Maximum Likelihood Estimates (MLE) for the mean and variance.

Formulas:

μ_MLE = (1/n) Σ x_i

σ²_MLE = (1/n) Σ (x_i - μ_MLE)²

Note: the MLE variance uses n (biased estimator), not n-1.

Function signature:

def mle_gaussian(X: list) -> tuple:
    # returns (mu, sigma2)

Input Format

Line 1: n — number of observations
Lines 2..n+1: one float per line — the data values

Output Format

One line: mu sigma2 — the MLE mean and variance (10 significant figures each)

Example

Input:

5
1.0
2.0
3.0
4.0
5.0

Output:

3 2

Notes

  • MLE variance = population variance (divide by n, not n-1).
  • numpy.var(X, ddof=0) computes the biased (MLE) variance.
  • The sample mean is always the MLE for the Gaussian mean.

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.