Repository: qiskit-community/qiskit-machine-learning (language: python)

Issue:
Fix QNN for input and weights ordering
<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add it in the CHANGELOG file under Unreleased section.
⚠️ If your pull request fixes an open issue, please link to the issue.

✅ I have added the tests to cover my changes.
✅ I have updated the documentation accordingly.
✅ I have read the CONTRIBUTING document.
-->

### Summary

Fixes #727

Reassigns QNN circuit parameters so the order of circuit.parameters, which is alphanumerically ordered when returned, comes out as as desired for the primitive and the data (parameters) as ordered there which is inputs followed by weights in the given array.

### Details and comments

I added a method to reassign parameters in the circuit so it's a new circuit copy from that supplied, but whose parameters are in the order needed by the data passed to the primitive when it runs. This I put in `self._circuit` so that internally its using this circuit now when running etc. As there are parameter and circuit getters, I left these all returning what was passed in originally ( as before) so the original circuit is assigned to a different named instance var which is returned by the getter. 

So what is run is equivalent but not the circuit as that passed. An alternative would be to alter the data order so it corresponds to the order of the parameters. This seemed less desirable on initial discussion since it changes the data. 

This PR still needs a release note but I figured lets settle that this is how we want to proceed before I do that. Not that I imagine it would change the text thereof though. **_Update_**: I added one anyway...

- [x] Add release note
- [x] Address change in tutorial `11_quantum_convolutional_neural_networks` (see comment below in this page)

Fixes #678

In updating the tutorial with a new initial point I saw the issue described in #678 where "c1" was not a latin c from the overall parameter order (indeed searching for c in the text did not locate it) So this addresses that issue too.
As part of the update I also set a random_state to the test_train_split so the result in the notebook in the same each time its run. Otherwise the split is different each time which made the results different each time.

This is one of the tutorials, per issue #725, where the circuit.draw("mpl") has deprectation messages so since this is being modified I corrected that as well, just for this tutorial, and used the clifford style which keeps the same look as before
Fix copyright dates from PR #728 for 2024
<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add it in the CHANGELOG file under Unreleased section.
⚠️ If your pull request fixes an open issue, please link to the issue.

✅ I have added the tests to cover my changes.
✅ I have updated the documentation accordingly.
✅ I have read the CONTRIBUTING document.
-->

### Summary

#728 was created last year but upon merge earlier today I guess the last updated dates of the files are now 2024 when the branch of my fork, and the files that were modified at the end of 2023, were merged into main. Indeed just pulling main and running the copyright check now fails for these files. This PR simply updates the copyright dates for these so CI will pass.

```
Wrong Copyright Year:'test/neural_networks/test_estimator_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/neural_network.py':  Current:'# (C) Copyright IBM 2020, 2023.' Correct:'# (C) Copyright IBM 2020, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/estimator_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/sampler_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
```

### Details and comments



Fix copyright dates from PR #728 for 2024
<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add it in the CHANGELOG file under Unreleased section.
⚠️ If your pull request fixes an open issue, please link to the issue.

✅ I have added the tests to cover my changes.
✅ I have updated the documentation accordingly.
✅ I have read the CONTRIBUTING document.
-->

### Summary

#728 was created last year but upon merge earlier today I guess the last updated dates of the files are now 2024 when the branch of my fork, and the files that were modified at the end of 2023, were merged into main. Indeed just pulling main and running the copyright check now fails for these files. This PR simply updates the copyright dates for these so CI will pass.

```
Wrong Copyright Year:'test/neural_networks/test_estimator_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/neural_network.py':  Current:'# (C) Copyright IBM 2020, 2023.' Correct:'# (C) Copyright IBM 2020, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/estimator_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
Wrong Copyright Year:'qiskit_machine_learning/neural_networks/sampler_qnn.py':  Current:'# (C) Copyright IBM 2022, 2023.' Correct:'# (C) Copyright IBM 2022, 2024.'
```

### Details and comments





Discussion / hints:
## Pull Request Test Coverage Report for [Build 7451895217](https://coveralls.io/builds/64942462)


* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage decreased (**-0.09%**) to **92.567%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/64942462/badge)](https://coveralls.io/builds/64942462) |
| :-- | --: |
| Change from base [Build 7451842530](https://coveralls.io/builds/64942291): |  -0.09% |
| Covered Lines: | 1868 |
| Relevant Lines: | 2018 |

---
##### 💛  - [Coveralls](https://coveralls.io)

A note:

As the standard feature map is mostly used in tests and tutorials with "x" as the name and the standard ansatzes used with greek theta the order was naturally as needed so no change in tests was needed and the tutorials look the same as before etc....

But with the exception of 11_quantum_convolutional_neural_networks whose behavior is now different and may need to be reviewed. In it it says

> Since model training may take a long time we have already pre-trained the model for some iterations and saved the pre-trained weights. We’ll continue training from that point by setting initial_point to a vector of pre-trained weights.

The plot no longer looks flat like it did so most likely the initial point needs reviewing and the accuracy is lower now - most likely because maxiter is limited to 200 and it no longer reaches a more optimal solution

![image](https://github.com/qiskit-community/qiskit-machine-learning/assets/40241007/876df951-adae-4cf2-9f71-1025ec5e4c80)




Fix patch:
diff --git a/qiskit_machine_learning/neural_networks/estimator_qnn.py b/qiskit_machine_learning/neural_networks/estimator_qnn.py
index b2f05e655..d0c8d2d7d 100644
--- a/qiskit_machine_learning/neural_networks/estimator_qnn.py
+++ b/qiskit_machine_learning/neural_networks/estimator_qnn.py
@@ -1,6 +1,6 @@
 # This code is part of a Qiskit project.
 #
-# (C) Copyright IBM 2022, 2023.
+# (C) Copyright IBM 2022, 2024.
 #
 # This code is licensed under the Apache License, Version 2.0. You may
 # obtain a copy of this license in the LICENSE.txt file in the root directory
diff --git a/qiskit_machine_learning/neural_networks/neural_network.py b/qiskit_machine_learning/neural_networks/neural_network.py
index 67459f109..651abf4ae 100644
--- a/qiskit_machine_learning/neural_networks/neural_network.py
+++ b/qiskit_machine_learning/neural_networks/neural_network.py
@@ -1,6 +1,6 @@
 # This code is part of a Qiskit project.
 #
-# (C) Copyright IBM 2020, 2023.
+# (C) Copyright IBM 2020, 2024.
 #
 # This code is licensed under the Apache License, Version 2.0. You may
 # obtain a copy of this license in the LICENSE.txt file in the root directory
diff --git a/qiskit_machine_learning/neural_networks/sampler_qnn.py b/qiskit_machine_learning/neural_networks/sampler_qnn.py
index 9fc2d52d3..61930e2fa 100644
--- a/qiskit_machine_learning/neural_networks/sampler_qnn.py
+++ b/qiskit_machine_learning/neural_networks/sampler_qnn.py
@@ -1,6 +1,6 @@
 # This code is part of a Qiskit project.
 #
-# (C) Copyright IBM 2022, 2023.
+# (C) Copyright IBM 2022, 2024.
 #
 # This code is licensed under the Apache License, Version 2.0. You may
 # obtain a copy of this license in the LICENSE.txt file in the root directory


Test patch:
diff --git a/test/neural_networks/test_estimator_qnn.py b/test/neural_networks/test_estimator_qnn.py
index fc80e8e1e..566329f27 100644
--- a/test/neural_networks/test_estimator_qnn.py
+++ b/test/neural_networks/test_estimator_qnn.py
@@ -1,6 +1,6 @@
 # This code is part of a Qiskit project.
 #
-# (C) Copyright IBM 2022, 2023.
+# (C) Copyright IBM 2022, 2024.
 #
 # This code is licensed under the Apache License, Version 2.0. You may
 # obtain a copy of this license in the LICENSE.txt file in the root directory