%global _empty_manifest_terminate_build 0 Name: python-qiskit-machine-learning Version: 0.6.1 Release: 1 Summary: Qiskit Machine Learning: A library of quantum computing machine learning experiments License: Apache-2.0 URL: https://github.com/Qiskit/qiskit-machine-learning Source0: https://mirrors.aliyun.com/pypi/web/packages/09/c6/502e29169953df4a7c3f8539858d3546877198bf7cafa6318361d5d381c4/qiskit-machine-learning-0.6.1.tar.gz BuildArch: noarch Requires: python3-qiskit-terra Requires: python3-scipy Requires: python3-numpy Requires: python3-psutil Requires: python3-scikit-learn Requires: python3-fastdtw Requires: python3-setuptools Requires: python3-dill Requires: python3-sparse Requires: python3-torch %description ### Optional Installs * **PyTorch**, may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/). When PyTorch is installed, the `TorchConnector` facilitates its use of quantum computed networks. * **Sparse**, may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the package. Sparse being installed will enable the usage of sparse arrays/tensors. ### Creating Your First Machine Learning Programming Experiment in Qiskit Now that Qiskit Machine Learning is installed, it's time to begin working with the Machine Learning module. Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to train and test samples from a data set to see how accurately the test set can be classified. ```python from qiskit.algorithms.optimizers import COBYLA from qiskit.circuit.library import TwoLocal, ZZFeatureMap from qiskit.utils import algorithm_globals from qiskit_machine_learning.algorithms import VQC from qiskit_machine_learning.datasets import ad_hoc_data seed = 1376 algorithm_globals.random_seed = seed # Use ad hoc data set for training and test data feature_dim = 2 # dimension of each data point training_size = 20 test_size = 10 # training features, training labels, test features, test labels as np.ndarray, # one hot encoding for labels training_features, training_labels, test_features, test_labels = ad_hoc_data( training_size=training_size, test_size=test_size, n=feature_dim, gap=0.3 ) feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement="linear") ansatz = TwoLocal(feature_map.num_qubits, ["ry", "rz"], "cz", reps=3) vqc = VQC( feature_map=feature_map, ansatz=ansatz, optimizer=COBYLA(maxiter=100), ) vqc.fit(training_features, training_labels) score = vqc.score(test_features, test_labels) print(f"Testing accuracy: {score:0.2f}") ``` ### Further examples Learning path notebooks may be found in the [Machine Learning tutorials](https://qiskit.org/documentation/machine-learning/tutorials/index.html) section of the documentation and are a great place to start. Another good place to learn the fundamentals of quantum machine learning is the [Quantum Machine Learning](https://learn.qiskit.org/course/machine-learning/introduction) course on the Qiskit Textbook's website. The course is very convenient for beginners who are eager to learn quantum machine learning from scratch, as well as understand the background and theory behind algorithms in Qiskit Machine Learning. The course covers a variety of topics to build understanding of parameterized circuits, data encoding, variational algorithms etc., and in the end the ultimate goal of machine learning - how to build and train quantum ML models for supervised and unsupervised learning. The textbook course is complementary to the tutorials of this module, where the tutorials focus on actual Qiskit Machine Learning algorithms, the course more explains and details underlying fundamentals %package -n python3-qiskit-machine-learning Summary: Qiskit Machine Learning: A library of quantum computing machine learning experiments Provides: python-qiskit-machine-learning BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-qiskit-machine-learning ### Optional Installs * **PyTorch**, may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/). When PyTorch is installed, the `TorchConnector` facilitates its use of quantum computed networks. * **Sparse**, may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the package. Sparse being installed will enable the usage of sparse arrays/tensors. ### Creating Your First Machine Learning Programming Experiment in Qiskit Now that Qiskit Machine Learning is installed, it's time to begin working with the Machine Learning module. Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to train and test samples from a data set to see how accurately the test set can be classified. ```python from qiskit.algorithms.optimizers import COBYLA from qiskit.circuit.library import TwoLocal, ZZFeatureMap from qiskit.utils import algorithm_globals from qiskit_machine_learning.algorithms import VQC from qiskit_machine_learning.datasets import ad_hoc_data seed = 1376 algorithm_globals.random_seed = seed # Use ad hoc data set for training and test data feature_dim = 2 # dimension of each data point training_size = 20 test_size = 10 # training features, training labels, test features, test labels as np.ndarray, # one hot encoding for labels training_features, training_labels, test_features, test_labels = ad_hoc_data( training_size=training_size, test_size=test_size, n=feature_dim, gap=0.3 ) feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement="linear") ansatz = TwoLocal(feature_map.num_qubits, ["ry", "rz"], "cz", reps=3) vqc = VQC( feature_map=feature_map, ansatz=ansatz, optimizer=COBYLA(maxiter=100), ) vqc.fit(training_features, training_labels) score = vqc.score(test_features, test_labels) print(f"Testing accuracy: {score:0.2f}") ``` ### Further examples Learning path notebooks may be found in the [Machine Learning tutorials](https://qiskit.org/documentation/machine-learning/tutorials/index.html) section of the documentation and are a great place to start. Another good place to learn the fundamentals of quantum machine learning is the [Quantum Machine Learning](https://learn.qiskit.org/course/machine-learning/introduction) course on the Qiskit Textbook's website. The course is very convenient for beginners who are eager to learn quantum machine learning from scratch, as well as understand the background and theory behind algorithms in Qiskit Machine Learning. The course covers a variety of topics to build understanding of parameterized circuits, data encoding, variational algorithms etc., and in the end the ultimate goal of machine learning - how to build and train quantum ML models for supervised and unsupervised learning. The textbook course is complementary to the tutorials of this module, where the tutorials focus on actual Qiskit Machine Learning algorithms, the course more explains and details underlying fundamentals %package help Summary: Development documents and examples for qiskit-machine-learning Provides: python3-qiskit-machine-learning-doc %description help ### Optional Installs * **PyTorch**, may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/). When PyTorch is installed, the `TorchConnector` facilitates its use of quantum computed networks. * **Sparse**, may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the package. Sparse being installed will enable the usage of sparse arrays/tensors. ### Creating Your First Machine Learning Programming Experiment in Qiskit Now that Qiskit Machine Learning is installed, it's time to begin working with the Machine Learning module. Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to train and test samples from a data set to see how accurately the test set can be classified. ```python from qiskit.algorithms.optimizers import COBYLA from qiskit.circuit.library import TwoLocal, ZZFeatureMap from qiskit.utils import algorithm_globals from qiskit_machine_learning.algorithms import VQC from qiskit_machine_learning.datasets import ad_hoc_data seed = 1376 algorithm_globals.random_seed = seed # Use ad hoc data set for training and test data feature_dim = 2 # dimension of each data point training_size = 20 test_size = 10 # training features, training labels, test features, test labels as np.ndarray, # one hot encoding for labels training_features, training_labels, test_features, test_labels = ad_hoc_data( training_size=training_size, test_size=test_size, n=feature_dim, gap=0.3 ) feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement="linear") ansatz = TwoLocal(feature_map.num_qubits, ["ry", "rz"], "cz", reps=3) vqc = VQC( feature_map=feature_map, ansatz=ansatz, optimizer=COBYLA(maxiter=100), ) vqc.fit(training_features, training_labels) score = vqc.score(test_features, test_labels) print(f"Testing accuracy: {score:0.2f}") ``` ### Further examples Learning path notebooks may be found in the [Machine Learning tutorials](https://qiskit.org/documentation/machine-learning/tutorials/index.html) section of the documentation and are a great place to start. Another good place to learn the fundamentals of quantum machine learning is the [Quantum Machine Learning](https://learn.qiskit.org/course/machine-learning/introduction) course on the Qiskit Textbook's website. The course is very convenient for beginners who are eager to learn quantum machine learning from scratch, as well as understand the background and theory behind algorithms in Qiskit Machine Learning. The course covers a variety of topics to build understanding of parameterized circuits, data encoding, variational algorithms etc., and in the end the ultimate goal of machine learning - how to build and train quantum ML models for supervised and unsupervised learning. The textbook course is complementary to the tutorials of this module, where the tutorials focus on actual Qiskit Machine Learning algorithms, the course more explains and details underlying fundamentals %prep %autosetup -n qiskit-machine-learning-0.6.1 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-qiskit-machine-learning -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 0.6.1-1 - Package Spec generated