← Back to Problems
Gap Fill
Easy prediction Linear Algebra Probability & Statistics
Time limit: 4 s per test  ·  Memory: 256 MB

A data vendor delivers a panel of daily returns for n assets over T days, but some entries are missing. The returns were generated by a factor model with k factors:

r_it = b_i^T f_t + eps_it

where b_i is the loading vector of asset i, f_t is the factor vector on day t, and eps_it ~ N(0, sigma_i^2) is independent noise with an asset-specific variance. The number of factors k is given; the loadings, the factors and the noise variances are not disclosed and vary between test cases.

Fill in the missing entries.

Input

The first line contains n, T and k. Each of the next n lines contains T values, the returns of one asset over the T days: either a real number with 8 digits after the decimal point, or the token NA for a missing entry.

Output

One real number per missing entry: your prediction of that return. Print them in row-major order, i.e. all missing entries of asset 1 from left to right, then those of asset 2, and so on.

Scoring

A prediction y for the missing entry (i, t) is scored by its predictive efficiency

s_it = sigma_i^2 / (sigma_i^2 + (y - b_i^T f_t)^2)

the ratio of the expected squared error of the optimal prediction to yours. The case score is the mean of s_it over the missing entries. Note that b_i . f_t is the signal part of the return, without the noise, so a score of 1.0 requires the exact loadings and factors.

Constraints

40 <= n <= 60

150 <= T <= 250

2 <= k <= 5

Between 10% and 20% of the entries are missing. Every asset and every day has at least k + 5 observed entries.

Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2
Discussion
No comments yet. Kick off the discussion.