ICP4 - PallaviArikatla/Python GitHub Wiki
Introduction to Machine Learning.
TASKS:
Question 1: find the correlation between ‘survived’(target column) and ‘sex’ column for the Titanic use case in class.
Read the given csv data. Map the values of gender to 0 and 1 in order to make comparison between the survived data and gender data. Use the "corr" function to map the correlation between the two data sets.
OUTPUT:
Question 2: Implement Naïve Bayes method using scikit-learn library.
Import pandas and all the libraries. load the predictors in to the x train and the target into the y train. Now use the train_test_split two split the data randomly with a test size varies between 0 and 1 and with a random state of 0.(Default random state). Then create an instance of the Gaussian distribution and calculate the accuracy score using the test data. The predicted y data set can be calculated using the guassian.predict function. Now plot the classification report with the target test data and target predicted data.
OUTPUT:
Question 3: Implement linear SVM method using scikit library.
Repeat the same procedure as mentioned above in question 2.
OUTPUT: