@@ -1322,8 +1322,8 @@ <h2 id="the-iris-data" class="anchor">The Iris data </h2>
13221322predictions< span style ="color: #666666 "> =</ span > svm_model< span style ="color: #666666 "> .</ span > predict(X_test)
13231323accuracy< span style ="color: #666666 "> =</ span > accuracy_score(Y_test,predictions)
13241324< span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the accuracy is: </ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > accuracy< span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
1325- mocrof1 < span style ="color: #666666 "> =</ span > f1_score(Y_test,predictions,average< span style ="color: #666666 "> =</ span > < span style ="color: #BA2121 "> 'macro'</ span > )
1326- < span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the mocro f1-score is:</ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > mocrof1 < span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
1325+ f1score < span style ="color: #666666 "> =</ span > f1_score(Y_test,predictions,average< span style ="color: #666666 "> =</ span > < span style ="color: #BA2121 "> 'macro'</ span > )
1326+ < span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the f1-score is:</ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > f1score < span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
13271327< span style ="color: #008000 "> print</ span > (classification_report(Y_test,predictions))
13281328</ pre >
13291329</ div >
@@ -2412,8 +2412,8 @@ <h2 id="iris-dataset" class="anchor">Iris Dataset </h2>
24122412predictions< span style ="color: #666666 "> =</ span > qsvm< span style ="color: #666666 "> .</ span > predict(X_test)
24132413accuracy< span style ="color: #666666 "> =</ span > accuracy_score(Y_test,predictions)
24142414< span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the accuracy is: </ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > accuracy< span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
2415- macrof1 < span style ="color: #666666 "> =</ span > f1_score(Y_test,predictions,average< span style ="color: #666666 "> =</ span > < span style ="color: #BA2121 "> 'macro'</ span > )
2416- < span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the mocro f1-score is: </ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > mocrof1 < span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
2415+ f1score < span style ="color: #666666 "> =</ span > f1_score(Y_test,predictions,average< span style ="color: #666666 "> =</ span > < span style ="color: #BA2121 "> 'macro'</ span > )
2416+ < span style ="color: #008000 "> print</ span > (< span style ="color: #BA2121 "> f"the f1-score is: </ span > < span style ="color: #BB6688; font-weight: bold "> {</ span > f1score < span style ="color: #BB6688; font-weight: bold "> :</ span > < span style ="color: #BA2121 "> .2f</ span > < span style ="color: #BB6688; font-weight: bold "> }</ span > < span style ="color: #BA2121 "> %"</ span > )
24172417< span style ="color: #008000 "> print</ span > (classification_report(Y_test,predictions))
24182418</ pre >
24192419</ div >
0 commit comments