TASK 8: Deploy Support Vector Machine, Apriori Algorithm: BTCS619-18
TASK 8: Deploy Support Vector Machine, Apriori Algorithm: BTCS619-18
Read CSV
In [4]: df =pd.read_csv('iris.csv')
df.head()
In [5]: df.dtypes
Out[5]: Id int64
SepalLengthCm float64
SepalWidthCm float64
PetalLengthCm float64
PetalWidthCm float64
Species object
dtype: object
In [6]: df.columns
Out[9]: ▾ SVC i ?
SVC(kernel='linear')
Classification Report
[[ 9 0 0]
[ 0 11 2]
[ 0 0 8]]
precision recall f1-score support
accuracy 0.93 30
macro avg 0.93 0.95 0.94 30
weighted avg 0.95 0.93 0.93 30
Out[12]: ▾ SVC i ?
SVC(degree=8, kernel='poly')
In [13]: y_pred=svclassifier.predict(x_test)
Classification Report
[[ 9 0 0]
[ 0 11 2]
[ 0 0 8]]
precision recall f1-score support
accuracy 0.93 30
macro avg 0.93 0.95 0.94 30
weighted avg 0.95 0.93 0.93 30
Out[15]: ▾ SVC i ?
SVC()
In [16]: y_pred=svclassifier.predict(x_test)
Classification Report
[[ 9 0 0]
[ 0 11 2]
[ 0 0 8]]
precision recall f1-score support
accuracy 0.93 30
macro avg 0.93 0.95 0.94 30
weighted avg 0.95 0.93 0.93 30
Out[18]: ▾ SVC i ?
SVC(kernel='sigmoid')
2232884
In [19]: y_pred=svclassifier.predict(x_test)
Classification Report
[[ 0 0 9]
[ 0 0 13]
[ 0 0 8]]
precision recall f1-score support
accuracy 0.27 30
macro avg 0.09 0.33 0.14 30
weighted avg 0.07 0.27 0.11 30
C:\Users\jaska\anaconda3\Lib\site-packages\sklearn\metrics\_classification.py:153
1: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in label
s with no predicted samples. Use `zero_division` parameter to control this behavi
or.
_warn_prf(average, modifier, f"{metric.capitalize()} is", len(result))
C:\Users\jaska\anaconda3\Lib\site-packages\sklearn\metrics\_classification.py:153
1: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in label
s with no predicted samples. Use `zero_division` parameter to control this behavi
or.
_warn_prf(average, modifier, f"{metric.capitalize()} is", len(result))
C:\Users\jaska\anaconda3\Lib\site-packages\sklearn\metrics\_classification.py:153
1: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in label
s with no predicted samples. Use `zero_division` parameter to control this behavi
or.
_warn_prf(average, modifier, f"{metric.capitalize()} is", len(result))
Bar Graph