Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The na ve Bayes method is an ensemble method, as we learned in Lecture 5 . Assume we have three classifiers, and their predicted results

The nave Bayes method is an ensemble method, as we learned in Lecture 5. Assume we have three classifiers, and their predicted results are given in Table 4.1. The confusion matrix of each classifier is given in Table 4.2. Calculate the final decision using the Nave Bayes method: Table 4.1 Sample x Result Classifier 1 Class 1 Classifier 2 Class 1 Classifier 3 Class 2 Table 4.2 Programming Problem(s): 5. Use decision tree and random forest to train models using the titanic.csv dataset included in this assignment. Step 1: Read titanic.csv and observe a few samples, noting that there are both categorical and numerical features. If some features are missing, fill them in using the average of the same feature of other samples. Take a random 80% of samples for training and use the remaining 20% for testing. Step 2: Fit a decision tree model using independent variables pclass + sex + age + sibsp and dependent variable survived. Plot the full tree. Make sure survived is a qualitative variable taking 1(yes) or 0(no) in your code. You may see a tree similar to this one, but the actual structure and size may vary: Step 3: Use the GridSearchCV() function to find the best value for the parameter max_leaf_nodes to prune the tree. Plot the pruned tree, which will be smaller than the tree you obtained in Step 2. b) Classifier 1 Class 1 Class 2 Class 14010 Class 23020 a) Classifier 2 Class 1 Class 2 Class 12030 Class 22030 c) Classifier 3 Class 1 Class 2 Class 1500 Class 24010

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started