Support Vector Machines Deep Intuition PART-III (Kernels)

Like this
import pandas as pdfrom sklearn.datasets import make_classificationfrom sklearn.model_selection import train_test_splitfrom sklearn.svm import LinearSVC, SVCfrom sklearn import metricsX,y = make_classification(n_samples=200,n_features=10,random_state=20)X_train,X_test,y_train,y_test = train_test_split(X,y,random_state = 43)Model = LinearSVC()Model.fit(X_train, y_train)print("Model Trained")predictions = Model.predict(X_test)print("predictions made")print(type(predictions[0]))print(predictions[:5])print(type(y_test[0]))Model1 = SVC()Model1.fit(X_train, y_train)predictions1 = Model1.predict(X_test)print("Linear SVC's accuracy is:"+str(round(metrics.accuracy_score(y_test, predictions)*100, 2)))print("SVC's accuracy is:"+str(round(metrics.accuracy_score(y_test, predictions1)*100, 2)))

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store