Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Data Science for Marketing Analytics

You're reading from   Data Science for Marketing Analytics Achieve your marketing goals with the data analytics power of Python

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher
ISBN-13 9781789959413
Length 420 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Tommy Blanchard Tommy Blanchard
Author Profile Icon Tommy Blanchard
Tommy Blanchard
Debasish Behera Debasish Behera
Author Profile Icon Debasish Behera
Debasish Behera
Pranshu Bhatnagar Pranshu Bhatnagar
Author Profile Icon Pranshu Bhatnagar
Pranshu Bhatnagar
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Data Science for Marketing Analytics
Preface
1. Data Preparation and Cleaning 2. Data Exploration and Visualization FREE CHAPTER 3. Unsupervised Learning: Customer Segmentation 4. Choosing the Best Segmentation Approach 5. Predicting Customer Revenue Using Linear Regression 6. Other Regression Techniques and Tools for Evaluation 7. Supervised Learning: Predicting Customer Churn 8. Fine-Tuning Classification Algorithms 9. Modeling Customer Choice Appendix

Class Imbalanced Data


Class imbalance is the most common problem that a data scientist can encounter. Most real-world classification tasks involve classifying data, where one class or multiple classes are over-represented. This is called class imbalance. Common examples where class-imbalanced data is encountered is in fraud detection, anti-money laundering, spam detection, and cancer detection.

Exercise 47: Performing Classification on Imbalanced Data

For this exercise, we are going to use the mammography dataset from UCI. The dataset contains some attributes of patients, using which we need to build a model that can predict whether a patient will have cancer (that is, a malignant outcome, indicated by 1) or not (that is, a benign outcome, indicated by −1). 70% of the dataset has benign outcomes; hence, it is a highly imbalanced dataset. In this exercise, we will observe how imbalanced data affects the performance of a model:

  1. Import fetch_datasets, pandas, RandomForestClassifier, train_test_split...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime