Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cross reference of classes from terra #499

Closed

Conversation

Ryand1234
Copy link

Summary

Fixes #474

Details and comments

Replaced plain class names from terra with cross references.

@CLAassistant
Copy link

CLAassistant commented Oct 25, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@adekusar-drl adekusar-drl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this issue. The PR is a good starting point, but there are other places to look at:

  • QuantumKernel
  • QuantumKernelTrainer, there local and non-local references
  • RawFeatureVector

And other classes to check out.

@Ryand1234
Copy link
Author

Hi @adekusar-drl in this issue and PR we were changing references from class that belongs to terra. Will it be okay to update references for classes which belongs to this repo like QuantumKernal in this PR? or should I create new PR for it?

@adekusar-drl
Copy link
Collaborator

@Ryand1234 certainly, you can update reference to all classes you find in the docstrings, either they are in Terra or here in QML. The point is that if the references are properly formatted, they become hyper links in the online documentation.

@woodsp-ibm
Copy link
Member

For the CLA it goes by the email in the commits which comes from your local git config. If it cannot resolve that email to a github user id then it shows the user name from your git config. Maybe you used different machines to do this PR. One way to fix this is to add the other email to your github account.

@woodsp-ibm woodsp-ibm added documentation 📖 Community PR 🌐 PRs from contributors that are not 'members' of the Qiskit organization labels Oct 25, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build 3330879471

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.08%) to 88.323%

Files with Coverage Reduction New Missed Lines %
qiskit_machine_learning/datasets/gaussian.py 3 37.11%
Totals Coverage Status
Change from base Build 3314522571: -0.08%
Covered Lines: 3260
Relevant Lines: 3691

💛 - Coveralls

@@ -84,11 +84,13 @@ def __init__(

Raises:
ValueError:
- if ``quantum_kernel`` is passed and ``precomputed`` is set to ``True``. To use
a precomputed kernel, ``quantum_kernel`` has to be of the ``None`` type.
- if :class:`~qiskit_machine_learning.kernels.FidelityQuantumKernel` is passed and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change to make things specific makes it incorrect. The quantum_kernel parameter must be None if you say you will use a precomputed kernel when that parameter is True. A quantum_kernel by type just has to be subclass of BaseKernel - so by making some specific reference it changes the meaning somewhat.

Now its true that if precomputed is False and you do not pass a quantum_kernel, i.e. you leave it at None, then it creates an instance of that specific subclass - but overall its not limited to that. Arguably this default when None and precomputed is False ought to be noted in the docstring above.

Comment on lines 91 to +93
TypeError:
- if ``quantum_kernel`` neither instance of
:class:`~qiskit_machine_learning.kernels.BaseKernel` nor ``None``.
- if :class:`~qiskit_machine_learning.kernels.FidelityQuantumKernel` neither instance
of :class:`~qiskit_machine_learning.kernels.BaseKernel` nor ``None``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I think can be completely removed - the code did raise a TypeError but that seems to have been removed in a recent change since things are now more general around a BaseKernel rather than what was there before.

On thing I do note is that is that this routine raises a ValueError if C <= 0 i.e. not a positive number, which is not included above.

ansatz: The (parametrized) circuit to be used as an ansatz for the underlying
:class:`~qiskit_machine_learning.neural_networks.CircuitQNN`. If ``None`` is given
then the ``RealAmplitudes`` circuit is used.
then the :class:`~qiskit.circuit.library.RealAmplitudes` circuit is used.
loss: A target loss function to be used in training. Default value is ``cross_entropy``.
optimizer: An instance of an optimizer to be used in training. When ``None`` defaults
to SLSQP.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SLSQP here could be written as :class:`~qiskit.algorithms.optimizers.SLSQP` since this is the actual optimizer class it defaults to. This default is actually done in TrainableModel class where it could be altered the same way,

@adekusar-drl
Copy link
Collaborator

@Ryand1234 will you continue to work on this pull request?

@adekusar-drl
Copy link
Collaborator

@Ryand1234 Are there any updates here?

@adekusar-drl
Copy link
Collaborator

Closing the PR as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR 🌐 PRs from contributors that are not 'members' of the Qiskit organization documentation 📖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update references to Terra's classes in docstrings
5 participants