Preparando MOJI

Quantum Classification - Dataset 3

2000ms 262144K

Description:

You are given a training dataset, in which each entry is a features vector (an array of 2 real numbers) and a label 0 or 1 indicating the class to which this vector belongs.

Your goal is to use this dataset to train a quantum classification model that will accurately classify a validation dataset - a different dataset generated using the same data distribution as the training one. The error rate of classifying the validation dataset using your model (the percentage of incorrectly classified samples) should be less than 5%.

  • The quantum classification library that will use your model to classify the data is documented here.
  • This tutorial has an end-to-end example of training a model using this library as a Python notebook.
  • The warmup round editorial discusses solving easier problems features in the warmup round.
  • You can find the exact implementation of the testing harness for the D problems of this round, including the preprocessing methods, here.
  • You can find examples of training a model and using it for classification here.

Input:

Your code will not be given any inputs. Instead, you should use the provided dataset file to train your model.

The training dataset is represented as a JSON file and consists of two arrays, "Features" and "Labels". Each array has exactly 400 elements. Each element of the "Features" array is an array with 2 elements, each of them a floating-point number. Each element of the "Labels" array is the label of the class to which the corresponding element of the "Features" array belongs, 0 or 1.

Output:

Your code should return the description of the model you'd like to use in the following format:

  • The model is described using a tuple ((Int, Double[]), ControlledRotation[], (Double[], Double)).
  • The first element of the tuple describes the classical preprocessing you perform on the data before encoding it into the quantum classifier.
  • The second element of the tuple describes circuit geometry of the model as an array of controlled rotation gates.
  • The third element of the tuple describes numeric parameters of the model and is a tuple of an array of rotation angles used by the gates and the bias used to decide the class of the model.

Your code should have the following signature:

namespace Solution {
open Microsoft.Quantum.MachineLearning;

operation Solve () : ((Int, Double[]), ControlledRotation[], (Double[], Double)) {
// your code here
}
}

Classical preprocessing

This step allows you to add new features to the data before encoding it in the quantum state and feeding it into the classifier circuit. To do this, you need to pick one of the available preprocessing methods and return a tuple of its index and its parameters. The parameters of all methods are Double[].

  • Method 1: padding. The resulting data is a concatenation of the parameters and the features.
  • Method 2: tensor product. The resulting data is an array of pairwise products of the elements of the parameters and the features.
  • Method 3: fanout. The resulting data is a tensor product of the parameters, the features and the features (so that you have access to all pairwise products of features).
  • Method 4: split fanout. The resulting data is tensor product of (concatenation of the left halves of parameters and features) and (concatenation of the right halves).
  • Default method: no preprocessing. The features remain unchanged, the parameters are ignored. This method is used when any index other than 1-4 is returned.

After the preprocessing step the resulting data is encoded in the quantum state using amplitudes encoding: element $$$j$$$ of the data is encoded in the amplitude of basis state $$$|j\rangle$$$. If the length of the data array is not a power of 2, it is right-padded with $$$0$$$s to the nearest power of two; the number of qubits used for encoding is the exponent of that power.

Note:

Note that majority of the data analysis is going to happen "offline" before you submit the solution. The solution has to contain only the description of the trained model, not the training code itself - if you attempt to train the model "online" in your submitted code during the evaluation process, it will very likely time out.

Training your model offline is likely to involve:

  • Defining the circuit structure that your model will use.
  • Generating several parameter seed vectors - the values from which training the model will start.
  • Selecting appropriate hyperparameters of the training process (learning rate, batch size, tolerance, maximal number of iterations etc.)
  • Training a number of classification models (one per each seed vector and hyperparameter combination)
  • Selecting the best trained model and submitting it.

Informação

Codeforces

Provedor Codeforces

Código CF1357D1

Tags

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 10:02:37

Relacionados

Nada ainda