-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Evaluate quantum kernel matrix elements for identical samples (#432)
* bug fix * add reno * format reno * format reno * format reno * format reno * format reno * fix tests * fix style * fix mypy * code review * Update qiskit_machine_learning/kernels/quantum_kernel.py Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * Update releasenotes/notes/fix-quantum-kernel-duplicates-b75d6ed8a0f37f60.yaml Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * Update qiskit_machine_learning/kernels/quantum_kernel.py Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * Update qiskit_machine_learning/kernels/quantum_kernel.py Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com>
- Loading branch information
1 parent
bedc777
commit 43f4fb8
Showing
3 changed files
with
177 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
releasenotes/notes/fix-quantum-kernel-duplicates-b75d6ed8a0f37f60.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
features: | ||
- | | ||
Introduced a new parameter `evaluate_duplicates` in | ||
:class:`~qiskit_machine_learning.kernels.QuantumKernel`. This parameter defines a strategy how | ||
kernel matrix elements are evaluated if duplicate samples are found. | ||
Possible values are: | ||
- ``all`` means that all kernel matrix elements are evaluated, even the diagonal ones when | ||
training. This may introduce additional noise in the matrix. | ||
- ``off_diagonal`` when training the matrix diagonal is set to `1`, the rest elements are | ||
fully evaluated, e.g., for two identical samples in the dataset. When inferring, all | ||
elements are evaluated. This is the default value. | ||
- ``none`` when training the diagonal is set to `1` and if two identical samples are found | ||
in the dataset the corresponding matrix element is set to `1`. When inferring, matrix | ||
elements for identical samples are set to `1`. | ||
fixes: | ||
- | | ||
Fixed quantum kernel evaluation when duplicate samples are found in the dataset. Originally, | ||
kernel matrix elements were not evaluated for identical samples in the dataset and such elements | ||
were set wrongly to zero. Now we introduced a new parameter `evaluate_duplicates` that ensures | ||
that elements of the kernel matrix are evaluated correctly. See the feature section for more | ||
details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters