Reader small image

You're reading from  The Machine Learning Workshop - Second Edition

Product typeBook
Published inJul 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781839219061
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Hyatt Saleh
Hyatt Saleh
author image
Hyatt Saleh

Hyatt Saleh discovered the importance of data analysis for understanding and solving real-life problems after graduating from college as a business administrator. Since then, as a self-taught person, she not only works as a machine learning freelancer for many companies globally, but has also founded an artificial intelligence company that aims to optimize everyday processes. She has also authored Machine Learning Fundamentals, by Packt Publishing.
Read more about Hyatt Saleh

Right arrow

6. Building Your Own Program

Activity 6.01: Performing the Preparation and Creation Stages for the Bank Marketing Dataset

Solution:

Note

To ensure the reproducibility of the results available at https://packt.live/2RpIhn9, make sure that you use a random_state of 0 when splitting the datasets and a random_state of 2 when training the models.

  1. Open a Jupyter Notebook and import all the required elements:
    import pandas as pd
    from sklearn.preprocessing import LabelEncoder
    from sklearn.model_selection import train_test_split
    from sklearn.tree import DecisionTreeClassifier
    from sklearn.neural_network import MLPClassifier
    from sklearn.metrics import precision_score
  2. Load the dataset into the notebook. Make sure that you load the one that was edited previously, named bank-full-dataset.csv, which is also available at https://packt.live/2wnJyny:
    data = pd.read_csv("bank-full-dataset.csv")
    data.head(10)

    The output is as follows:

    Figure 6.8: A screenshot showing...

lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
The Machine Learning Workshop - Second Edition
Published in: Jul 2020Publisher: PacktISBN-13: 9781839219061

Author (1)

author image
Hyatt Saleh

Hyatt Saleh discovered the importance of data analysis for understanding and solving real-life problems after graduating from college as a business administrator. Since then, as a self-taught person, she not only works as a machine learning freelancer for many companies globally, but has also founded an artificial intelligence company that aims to optimize everyday processes. She has also authored Machine Learning Fundamentals, by Packt Publishing.
Read more about Hyatt Saleh