Martian Samples#422

Martian Samples

Medium

After deciphering the combination lock (using analysis of Martian glyphs), Kozak Vus's team entered the first section of the bunker. There they discovered strange mineral formations — Martian samples. Analysis showed that each sample is characterized by a set of numerical indicators (element concentrations, spectral data, etc.). Doctor Oseledets, the mission's chief scientist, hypothesized that a certain Geochemical Index of each sample is key to understanding the technologies of this civilization. Importantly, this index depends only on the set of sample indicators, not on the order of their measurement or recording, i.e., it is invariant under permutations. To activate the bunker's subsequent systems, the team needs to learn to quickly calculate this index for new samples. There are three different sets of samples. In the first, each sample is characterized by indicators, in the second by 10^4, and in the third by 2\cdot10^4. It is also known that the geochemical index is determined by the same function for the second and third sets, but the function for the first set may differ.

You are provided with the archive 'train.zip', which contains files for training your model. It contains the files: 'S1_train_x.txt', 'S1_train_y.txt', 'S2_train_x.txt', 'S2_train_y.txt' — training data for the first and second sets, respectively. Files whose names end with '_x' have the indicators of the -th sample in the -th row, written space-separated. Files whose names end with '_y' have the geochemical index of the -th sample in the -th row. Note that no training data is provided for the third set of samples.

Input

You are provided with three test sets in the archives 'test1.zip', 'test2.zip', and 'test3.zip' — for the first, second, and third subtasks, respectively. Each of them contains one txt-file, in the -th row of which the indicators of the -th sample from the corresponding set are written, separated by spaces.

Output

For each test set, write all results to a separate file: one geochemical index value per line. The geochemical index for the -th sample must be in the -th row. Note that you must write the results for different subtasks to different files. Note that in this task, you only need to submit the answer file.

Scoring

The final score for the task is the sum of the maximum points obtained for each subtask across all your attempts (submissions).

Let denote the number of indicators in a sample, and — the number of samples in the test set. Also, let y_i denote your answer for the -th sample, and t_i — the true value. Let a = \sum_{i=1}^k \frac{(y_i - t_i)^2}{k} (mean squared error — MSE) and b = \max_{i=1}^k |y_i - t_i| (maximum absolute error). Let a_1, a_2, b_1, b_2 be variables that depend on the subtask. We define the normalized score for MSE, \overline{a}, as:

  • 0, if a_1 \leq a;

  • \frac{a_1 - a}{a_1 - a_2}, if a_2 < a < a_1;

  • 1, if a \leq a_2.

We define the normalized score for maximum error, \overline{b}, as:

  • 0, if b_1 \leq b;

  • \frac{b_1 - b}{b_1 - b_2}, if b_2 < b < b_1;

  • 1, if b \leq b_2.

Let s = 0.7\overline{a} + 0.3\overline{b}. Your score for the subtask will be s \times (\text{points for the subtask}).

  1. (15 points): n = 10, a_1 = 0.35, a_2 = 0.04, b_1 = 1.8, b_2 = 0.9.

  2. (40 points): n = 10^4, a_1 = 0.4, a_2 = 0.035, b_1 = 2, b_2 = 0.85.

  3. (45 points): n = 2\cdot10^4, a_1 = 0.4, a_2 = 0.035, b_1 = 2, b_2 = 0.85.