Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!