Answered step by step
Verified Expert Solution
Question
1 Approved Answer
survived = df.iloc[np.where((df.Survived==1) & (df.Sex == 'male'))[0],:] passed = df.iloc[np.where((df.Survived==0) & (df.Sex == 'male'))[0],:] -prob0*np.log2(prob0) 2]: df.head () [21: Passengerld Survived Pclass Name Sex Age
survived = df.iloc[np.where((df.Survived==1) & (df.Sex == 'male'))[0],:] passed = df.iloc[np.where((df.Survived==0) & (df.Sex == 'male'))[0],:]
-prob0*np.log2(prob0)
2]: df.head () [21: Passengerld Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked Braund, Mr. Owen Harris male 22.0 0 A/5 21171 7.2500 NaN Cumings, Mrs. John 1 Bradley (Florence Briggs female 38.0 0 PC 17599 71.2833 C85 STON/O2. 3101282 Heikkinen, Miss. Laina female 26.0 7.9250 NaN Futrelle, Mrs. Jacques female 35.0 3 113803 53.1000 C123 Heath (Lily May Pee) Allen, Mr. William Henry male 35.0 0 373450 8.0500 NaN 69]: print (prob0) print(prob1) 0.6161616161616161 0.3838383838383838 2]: df.head () [21: Passengerld Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked Braund, Mr. Owen Harris male 22.0 0 A/5 21171 7.2500 NaN Cumings, Mrs. John 1 Bradley (Florence Briggs female 38.0 0 PC 17599 71.2833 C85 STON/O2. 3101282 Heikkinen, Miss. Laina female 26.0 7.9250 NaN Futrelle, Mrs. Jacques female 35.0 3 113803 53.1000 C123 Heath (Lily May Pee) Allen, Mr. William Henry male 35.0 0 373450 8.0500 NaN 69]: print (prob0) print(prob1) 0.6161616161616161 0.3838383838383838Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started