The following languages are only available languages for the problems from the contest

Microsoft Q# Coding Contest - Summer 2020 - Warmup:

- Microsoft Q#

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
D2. Quantum Classification - 2

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThis problem statement is exactly the same as in the problem "Quantum Classification - 1"; the only difference is the training dataset used (and the model you need to train on it).

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.
- 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 200 elements. Each element of the "Features" array is an array with 2 elements, each of them a floating-point number between -1 and 1. 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 (ControlledRotation[], (Double[], Double)).
- The first element of the tuple describes circuit geometry of the model as an array of controlled rotation gates.
- The second 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 () : (ControlledRotation[], (Double[], Double)) {

// your code here

}

}

Please refer to the documentation and examples for details on each parameter.

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.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/22/2021 16:53:25 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|