Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Applied Supervised Learning with Python
  • Table Of Contents Toc
Applied Supervised Learning with Python

Applied Supervised Learning with Python

By : Benjamin Johnston, Ishita Mathur
5 (1)
close
close
Applied Supervised Learning with Python

Applied Supervised Learning with Python

5 (1)
By: Benjamin Johnston, Ishita Mathur

Overview of this book

Machine learning—the ability of a machine to give right answers based on input data—has revolutionized the way we do business. Applied Supervised Learning with Python provides a rich understanding of how you can apply machine learning techniques in your data science projects using Python. You'll explore Jupyter Notebooks, the technology used commonly in academic and commercial circles with in-line code running support. With the help of fun examples, you'll gain experience working on the Python machine learning toolkit—from performing basic data cleaning and processing to working with a range of regression and classification algorithms. Once you’ve grasped the basics, you'll learn how to build and train your own models using advanced techniques such as decision trees, ensemble modeling, validation, and error metrics. You'll also learn data visualization techniques using powerful Python libraries such as Matplotlib and Seaborn. This book also covers ensemble modeling and random forest classifiers along with other methods for combining results from multiple models, and concludes by delving into cross-validation to test your algorithm and check how well the model works on unseen data. By the end of this book, you'll be equipped to not only work with machine learning algorithms, but also be able to create some of your own!
Table of Contents (9 chapters)
close
close

Chapter 1: Python Machine Learning Toolkit


Activity 1: pandas Functions

Solution

  1. Open a new Jupyter notebook.

  2. Use pandas to load the Titanic dataset:

    import pandas as pd
    
    df = pd.read_csv('titanic.csv')

    Use the head() function on the dataset as follows:

    # Have a look at the first 5 sample of the data
    df.head()

    The output will be as follows:

    Figure 1.65: First five rows

    Use the describe function as follows:

    df.describe(include='all')

    The output will be as follows:

    Figure 1.66: Output of describe()

  3. We don't need the Unnamed: 0 column. We can remove the column without using the del command, as follows:

    df = df[df.columns[1:]] # Use the columns
    df.head()

    The output will be as follows:

    Figure 1.67: First five rows after deleting the Unnamed: 0 column

  4. Compute the mean, standard deviation, minimum, and maximum values for the columns of the DataFrame without using describe:

    df.mean()
    
    Fare        33.295479
    Pclass       2.294882
    Age         29.881138
    Parch        0.385027
    SibSp        0.498854
    Survived     0.383838...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Applied Supervised Learning with Python
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon