Svmdoc
Svmdoc
AIM :
ALGORITHM :
1. Import numpy, pandas and matplotlib package.
2. Load the user dataset.
3. Analysis data.
4. Collect all the independent and dependent variable
5. Splitting the dataset into training and test set.
6. Fitting the SVM classifier to the training set
7. Predicting the test set result
8. Creating the Confusion matrix
9. Visualizing the training set result
10. Visualizing the test set result
PROGRAM :
# importing libraries
import numpy as nm
import pandas as pd
# importing datasets
data_set= pd.read_csv('User_Data.csv')
x= data_set.iloc[:, [2,3]].values
y= data_set.iloc[:, 4].values
# Splitting the dataset into training and test set.
#feature Scaling
st_x= StandardScaler()
x_train= st_x.fit_transform(x_train)
x_test= st_x.transform(x_test)
classifier.fit(x_train, y_train)
y_pred= classifier.predict(x_test)
1, step =0.01),
x2.ravel()]).T).reshape(x1.shape),
mtp.xlim(x1.min(), x1.max())
mtp.ylim(x2.min(), x2.max())
for i, j in enumerate(nm.unique(y_set)):
mtp.xlabel('Age')
mtp.ylabel('Estimated Salary')
mtp.legend()
mtp.show()
RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in
case its length matches with *x* & *y*. Please use the *color* keyword-argument or provide a
2D array with a single row if you intend to specify the same RGB or RGBA value for all
points.
1, step =0.01),
x2.ravel()]).T).reshape(x1.shape),
mtp.xlim(x1.min(), x1.max())
mtp.ylim(x2.min(), x2.max())
for i, j in enumerate(nm.unique(y_set)):
mtp.xlabel('Age')
mtp.ylabel('Estimated Salary')
mtp.legend()
mtp.show()
OUTPUT :
RESULT :