Is there any difference bwtween PCA in qiskit.aqua and PCA in sklearn?

I am working on a data set and did some dimensional reduction on it (using sklearn) to be able to use it in qiskit (near term Quantum computers). But I just found out that there is already a utility in qiskit.aqua that does PCA, so is it better using the qiskit one since I am gonna deal with it in the rest of the program, or it dose not matter?

  • $\begingroup$ A good way to check this is to look at the source code. If you go to the docs (qiskit.org/documentation/stable/0.31/apidoc/…) for reduce_dim_to_via_pca and click [source], you will find that qiskit.aqua.utils.reduce_dim_to_via_pca(x, dim) is identical to sklearn.decompositions.PCA(n_components=dim).fit_transform(x) as of 0.31.0. $\endgroup$
    – forky40
    Jul 27 at 14:04
  • $\begingroup$ I will note that Qiskit Aqua was deprecated back in April 2021 when the code was moved/refactored in various different application specific packages e.g Qiskit Machine Learning. Qiskit Aqua is now no longer supported and the function has been superseded by these new application packages. Check out the tutorials here qiskit.org/documentation/machine-learning/tutorials/index.html - you will see it was designed for better integration/inter-working with scikit-learn. $\endgroup$
    – Steve Wood
    Jul 27 at 18:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.