You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The precision score of the Variational classifier is 0.40\nThe recall score of the Variational classifier is 0.52\nThe specificity score of the Variational classifier is 0.53\nThe npv score of the Variational classifier is 0.65\nThe information level is: 0.53\n"
704
+
]
705
+
}
706
+
],
707
+
"source": [
708
+
"# Listing 3.23: The scores of the random quantum classifier\n",
"\"\"\"returns a valid state vector from angle theta\"\"\"\n",
802
+
" return [cos(theta/2), sin(theta/2)]\n",
803
+
"\n",
804
+
"def pre_process_weighted(passenger):\n",
805
+
"\"\"\"\n",
806
+
" passenger -- the normalized (array of numeric data) passenger data\n",
807
+
" returns a valid quantum state\n",
808
+
"\"\"\"\n",
809
+
"\n",
810
+
" # caluclate the overall probability\n",
811
+
" mu = get_overall_probability(passenger, correlations)\n",
812
+
"\n",
813
+
" # theta between 0 (|0>) and pi (|1>)\n",
814
+
" quantum_state = get_state((1-mu)*pi)\n",
815
+
"\n",
816
+
" return quantum_state"
817
+
]
818
+
},
819
+
{
820
+
"cell_type": "code",
821
+
"execution_count": 36,
822
+
"metadata": {},
823
+
"outputs": [
824
+
{
825
+
"output_type": "stream",
826
+
"name": "stdout",
827
+
"text": [
828
+
"The precision score of the Variational classifier is 0.69\nThe recall score of the Variational classifier is 0.62\nThe specificity score of the Variational classifier is 0.83\nThe npv score of the Variational classifier is 0.78\nThe information level is: 0.73\n"
829
+
]
830
+
}
831
+
],
832
+
"source": [
833
+
"# Listing 3.28: Run the PQC with the weighted pre‐processing\n",
"The precision score of the Variational-Test classifier is 0.67\nThe recall score of the Variational-Test classifier is 0.73\nThe specificity score of the Variational-Test classifier is 0.75\nThe npv score of the Variational-Test classifier is 0.80\nThe information level is: 0.74\n"
853
+
]
854
+
}
855
+
],
856
+
"source": [
857
+
"# Listing 3.29: Test the PQC‐based classifier on data it has not seen before\n",
0 commit comments