Professional Documents
Culture Documents
Supervised Learning Flow Sample1
Supervised Learning Flow Sample1
[2]: data = pd.DataFrame({'Redness' : [10, 4, 3.1, 9.5, 5.0, 9.8, 2.3, 3.1, 2.8, 6.
,→3],
'Roundness' : [4, 10, 13.1, .95, 8.0, 3.9, 12.3, 13.1, 10.1, 16.
,→3],
'Price' : [20, 13, 12, 19, 10, 15, 9.3, 8.1, 4.2, 8.7],
'Fruit' : ['Apple', 'Orange', 'Orange', 'Apple', 'Orange',␣
,→'Apple', 'Orange', 'Orange', 'Orange', 'Apple']
})
data
1
[9]: print(X_train.shape)
print(X_test.shape)
print(y_train.shape)
print(y_test.shape)
(7, 3)
(3, 3)
(7,)
(3,)
[12]: SVC()
Prediction
[17]: my_predictions_logreg = my_logreg_model.predict(X_test)
my_predictions_DT = my_DT_model.predict(X_test)
my_predictions_SVM = my_SVM_model.predict(X_test)
2
print("The test accuracy for SVM Model : " ,accuracy_score(y_test,␣
,→my_predictions_SVM))
0.0.1 Inference
[ ]: