Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Import Data in python Execute the cell below to load the Titanic data from Seaborn and reduce it to the meaningful variables For this analysis,

Import Data in python
Execute the cell below to load the Titanic data from Seaborn and reduce it to the meaningful variables
For this analysis, the survived variable will be used as the target variable, while the rest of the variables are the input features.
The goal is to predict whether a passenger survived (survived =1) or died (survived =0) the Titanic sinking
In a Markdown cell, identify the categorical and numerical features
Examine the possible values each feature can assume
Hint: survived is the Target. There will be four of each type.
Partition Data into Training and Testing sets
Stratify on the target variable to maintain the imbalance in the data sets
Extract 20% for testing
Print the dimensions of the Training and Testing Data sets
Hint: Split into two DataFrames with the target present:
The output should be df_train, df_test
Using the Training Data, calculate the following:
Calculate and show ()()
The probability of each target label
Calculate and show (|)(|) for each of the categorical features in the Training Data
identify and show the means and standard deviations of the Continuous features
The probability of observing any value is assumed to the Normal Distribution:
(|)=(,)(|)=(,) given the target label
where and are calculated from each feature and target label
Construct a prediction function
This data set is of mixed types (Categorical and Continuous), so built-in functionality cannot work.
Recall, you are calculating:
(|())=argmax in {0,1}[()(()|)](|())=argmax in {0,1}[()(()|)]
Where yk=0=Died and yk=1=Survived
Your function should calculate the above expression for k=0 and k=1, and return both predictions for each instance considered.
Using your function, calculate the predictions from the Training data
Then, calculate the confusion matrix and accuracy score
Using your function, calculate the predictions from the Test data
Then, calculate the confusion matrix and accuracy score

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

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Explain how using dual-purpose tests can lower audit costs.

Answered: 1 week ago