Appendix

1. Introduction to Scikit-Learn

Activity 1.01: Selecting a Target Feature and Creating a Target Matrix

Solution:

  1. Load the titanic dataset using the seaborn library:

    import seaborn as sns

    titanic = sns.load_dataset('titanic')

    titanic.head(10)

    The first couple of rows should look as follows:

    Figure 1.22: An image showing the first 10 instances of the Titanic dataset

    Figure 1.22: An image showing the first 10 instances of the Titanic dataset

  2. Select your preferred target feature for the goal of this activity.

    The preferred target feature could be either survived or alive. This is mainly because both of them label whether a person survived the crash. For the following steps, the variable that's been chosen is survived ...

Get The Machine Learning Workshop - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.