py icp4 - koushikskr/python GitHub Wiki

ICP4 Introduction:

This ICP is about implementation of SVM and Navy Bayes algorithms.

Question 1:

find the correlation between ‘survived’(target column) and ‘sex’ column for the Titanic use case in class.

steps:

Created dataframes for the test and trained data files.

Created X_Train and Y_Train data frames for the model to fit and train into it.

Created SVC object and placed X_Train and Y_Train to train the model.

Found the correlation between two columns survived and sex.

Question 2:

Implement Naïve Bayes method using scikit-learn library

steps:

Created data frame from the given data set.

Created X_Train and Y_Train frames for the model.

Split the data into test and train for the model to train.

Created GaussianNB() object model to implement Navy Bayes algorithm.

Trained the model with Trained data.

Found predictions using X_Test data.

Found accuracy score from the test data and predicted data.

Got classification report for the test and predicated data.

Question 3:

Implement linear SVMmethodusing scikit library

steps:

Created data frame from the given data set.

Created X_Train and Y_Train frames for the model.

Split the data into test and train for the model to train.

Created SVC() object model to implement linear SVC algorithm.

Trained the model with Trained data.

Found predictions using X_Test data.

Found accuracy score from the test data and predicted data.

Got classification report for the test and predicated data.