0%

Turbocharge your marketing plans by making the leap from simple descriptive statistics in Excel to sophisticated predictive analytics with the Python programming language

Key Features

  • Use data analytics and machine learning in a sales and marketing context
  • Gain insights from data to make better business decisions
  • Build your experience and confidence with realistic hands-on practice

Book Description

Unleash the power of data to reach your marketing goals with this practical guide to data science for business.

This book will help you get started on your journey to becoming a master of marketing analytics with Python. You'll work with relevant datasets and build your practical skills by tackling engaging exercises and activities that simulate real-world market analysis projects.

You'll learn to think like a data scientist, build your problem-solving skills, and discover how to look at data in new ways to deliver business insights and make intelligent data-driven decisions.

As well as learning how to clean, explore, and visualize data, you'll implement machine learning algorithms and build models to make predictions. As you work through the book, you'll use Python tools to analyze sales, visualize advertising data, predict revenue, address customer churn, and implement customer segmentation to understand behavior.

By the end of this book, you'll have the knowledge, skills, and confidence to implement data science and machine learning techniques to better understand your marketing data and improve your decision-making.

What you will learn

  • Load, clean, and explore sales and marketing data using pandas
  • Form and test hypotheses using real data sets and analytics tools
  • Visualize patterns in customer behavior using Matplotlib
  • Use advanced machine learning models like random forest and SVM
  • Use various unsupervised learning algorithms for customer segmentation
  • Use supervised learning techniques for sales prediction
  • Evaluate and compare different models to get the best outcomes
  • Optimize models with hyperparameter tuning and SMOTE

Who this book is for

This marketing book is for anyone who wants to learn how to use Python for cutting-edge marketing analytics. Whether you're a developer who wants to move into marketing, or a marketing analyst who wants to learn more sophisticated tools and techniques, this book will get you on the right path.

Basic prior knowledge of Python and experience working with data will help you access this book more easily.

Table of Contents

  1. Data Science for Marketing Analytics
  2. second edition
  3. Preface
    1. About the Book
    2. About the Authors
    3. Who This Book Is For
    4. About the Chapters
    5. Conventions
    6. Code Presentation
    7. Minimum Hardware Requirements
    8. Downloading the Code Bundle
    9. Setting Up Your Environment
    10. Installing Anaconda on Your System
    11. Launching Jupyter Notebook
    12. Installing the ds-marketing Virtual Environment
    13. Running the Code Online Using Binder
    14. Get in Touch
    15. Please Leave a Review
  4. 1. Data Preparation and Cleaning
    1. Introduction
    2. Data Models and Structured Data
    3. pandas
    4. Importing and Exporting Data with pandas DataFrames
    5. Viewing and Inspecting Data in DataFrames
    6. Exercise 1.01: Loading Data Stored in a JSON File
    7. Exercise 1.02: Loading Data from Multiple Sources
    8. Structure of a pandas DataFrame and Series
    9. Data Manipulation
    10. Selecting and Filtering in pandas
    11. Creating DataFrames in Python
    12. Adding and Removing Attributes and Observations
    13. Combining Data
    14. Handling Missing Data
    15. Exercise 1.03: Combining DataFrames and Handling Missing Values
    16. Applying Functions and Operations on DataFrames
    17. Grouping Data
    18. Exercise 1.04: Applying Data Transformations
    19. Activity 1.01: Addressing Data Spilling
    20. Summary
  5. 2. Data Exploration and Visualization
    1. Introduction
    2. Identifying and Focusing on the Right Attributes
    3. The groupby(  ) Function
    4. The unique(  ) function
    5. The value_counts(  ) function
    6. Exercise 2.01: Exploring the Attributes in Sales Data
    7. Fine Tuning Generated Insights
    8. Selecting and Renaming Attributes
    9. Reshaping the Data
    10. Exercise 2.02: Calculating Conversion Ratios for Website Ads.
    11. Pivot Tables
    12. Visualizing Data
    13. Exercise 2.03: Visualizing Data With pandas
    14. Visualization through Seaborn
    15. Visualization with Matplotlib
    16. Activity 2.01: Analyzing Advertisements
    17. Summary
  6. 3. Unsupervised Learning and Customer Segmentation
    1. Introduction
    2. Segmentation
    3. Exercise 3.01: Mall Customer Segmentation – Understanding the Data
    4. Approaches to Segmentation
    5. Traditional Segmentation Methods
    6. Exercise 3.02: Traditional Segmentation of Mall Customers
    7. Unsupervised Learning (Clustering) for Customer Segmentation
    8. Choosing Relevant Attributes (Segmentation Criteria)
    9. Standardizing Data
    10. Exercise 3.03: Standardizing Customer Data
    11. Calculating Distance
    12. Exercise 3.04: Calculating the Distance between Customers
    13. K-Means Clustering
    14. Exercise 3.05: K-Means Clustering on Mall Customers
    15. Understanding and Describing the Clusters
    16. Activity 3.01: Bank Customer Segmentation for Loan Campaign
    17. Clustering with High-Dimensional Data
    18. Exercise 3.06: Dealing with High-Dimensional Data
    19. Activity 3.02: Bank Customer Segmentation with Multiple Features
    20. Summary
  7. 4. Evaluating and Choosing the Best Segmentation Approach
    1. Introduction
    2. Choosing the Number of Clusters
    3. Exercise 4.01: Data Staging and Visualization
    4. Simple Visual Inspection to Choose the Optimal Number of Clusters
    5. Exercise 4.02: Choosing the Number of Clusters Based on Visual Inspection
    6. The Elbow Method with Sum of Squared Errors
    7. Exercise 4.03: Determining the Number of Clusters Using the Elbow Method
    8. Activity 4.01: Optimizing a Luxury Clothing Brand's Marketing Campaign Using Clustering
    9. More Clustering Techniques
    10. Mean-Shift Clustering
    11. Exercise 4.04: Mean-Shift Clustering on Mall Customers
    12. Benefits and Drawbacks of the Mean-Shift Technique
    13. k-modes and k-prototypes Clustering
    14. Exercise 4.05: Clustering Data Using the k-prototypes Method
    15. Evaluating Clustering
    16. Silhouette Score
    17. Exercise 4.06: Using Silhouette Score to Pick Optimal Number of Clusters
    18. Train and Test Split
    19. Exercise 4.07: Using a Train-Test Split to Evaluate Clustering Performance
    20. Activity 4.02: Evaluating Clustering on Customer Data
    21. The Role of Business in Cluster Evaluation
    22. Summary
  8. 5. Predicting Customer Revenue Using Linear Regression
    1. Introduction
    2. Regression Problems
    3. Exercise 5.01: Predicting Sales from Advertising Spend Using Linear Regression
    4. Feature Engineering for Regression
    5. Feature Creation
    6. Data Cleaning
    7. Exercise 5.02: Creating Features for Customer Revenue Prediction
    8. Assessing Features Using Visualizations and Correlations
    9. Exercise 5.03: Examining Relationships between Predictors and the Outcome
    10. Activity 5.01: Examining the Relationship between Store Location and Revenue
    11. Performing and Interpreting Linear Regression
    12. Exercise 5.04: Building a Linear Model Predicting Customer Spend
    13. Activity 5.02: Predicting Store Revenue Using Linear Regression
    14. Summary
  9. 6. More Tools and Techniques for Evaluating Regression Models
    1. Introduction
    2. Evaluating the Accuracy of a Regression Model
    3. Residuals and Errors
    4. Mean Absolute Error
    5. Root Mean Squared Error
    6. Exercise 6.01: Evaluating Regression Models of Location Revenue Using the MAE and RMSE
    7. Activity 6.01: Finding Important Variables for Predicting Responses to a Marketing Offer
    8. Using Recursive Feature Selection for Feature Elimination
    9. Exercise 6.02: Using RFE for Feature Selection
    10. Activity 6.02: Using RFE to Choose Features for Predicting Customer Spend
    11. Tree-Based Regression Models
    12. Random Forests
    13. Exercise 6.03: Using Tree-Based Regression Models to Capture Non-Linear Trends
    14. Activity 6.03: Building the Best Regression Model for Customer Spend Based on Demographic Data
    15. Summary
  10. 7. Supervised Learning: Predicting Customer Churn
    1. Introduction
    2. Classification Problems
    3. Understanding Logistic Regression
    4. Revisiting Linear Regression
    5. Logistic Regression
    6. Cost Function for Logistic Regression
    7. Assumptions of Logistic Regression
    8. Exercise 7.01: Comparing Predictions by Linear and Logistic Regression on the Shill Bidding Dataset
    9. Creating a Data Science Pipeline
    10. Churn Prediction Case Study
    11. Obtaining the Data
    12. Exercise 7.02: Obtaining the Data
    13. Scrubbing the Data
    14. Exercise 7.03: Imputing Missing Values
    15. Exercise 7.04: Renaming Columns and Changing the Data Type
    16. Exploring the Data
    17. Exercise 7.05: Obtaining the Statistical Overview and Correlation Plot
    18. Visualizing the Data
    19. Exercise 7.06: Performing Exploratory Data Analysis (EDA)
    20. Activity 7.01: Performing the OSE technique from OSEMN
    21. Modeling the Data
    22. Feature Selection
    23. Exercise 7.07: Performing Feature Selection
    24. Model Building
    25. Exercise 7.08: Building a Logistic Regression Model
    26. Interpreting the Data
    27. Activity 7.02: Performing the MN technique from OSEMN
    28. Summary
  11. 8. Fine-Tuning Classification Algorithms
    1. Introduction
    2. Support Vector Machines
    3. Intuition behind Maximum Margin
    4. Linearly Inseparable Cases
    5. Linearly Inseparable Cases Using the Kernel
    6. Exercise 8.01: Training an SVM Algorithm Over a Dataset
    7. Decision Trees
    8. Exercise 8.02: Implementing a Decision Tree Algorithm over a Dataset
    9. Important Terminology for Decision Trees
    10. Decision Tree Algorithm Formulation
    11. Random Forest
    12. Exercise 8.03: Implementing a Random Forest Model over a Dataset
    13. Classical Algorithms – Accuracy Compared
    14. Activity 8.01: Implementing Different Classification Algorithms
    15. Preprocessing Data for Machine Learning Models
    16. Standardization
    17. Exercise 8.04: Standardizing Data
    18. Scaling
    19. Exercise 8.05: Scaling Data After Feature Selection
    20. Normalization
    21. Exercise 8.06: Performing Normalization on Data
    22. Model Evaluation
    23. Exercise 8.07: Stratified K-fold
    24. Fine-Tuning of the Model
    25. Exercise 8.08: Fine-Tuning a Model
    26. Activity 8.02: Tuning and Optimizing the Model
    27. Performance Metrics
    28. Precision
    29. Recall
    30. F1 Score
    31. Exercise 8.09: Evaluating the Performance Metrics for a Model
    32. ROC Curve
    33. Exercise 8.10: Plotting the ROC Curve
    34. Activity 8.03: Comparison of the Models
    35. Summary
  12. 9. Multiclass Classification Algorithms
    1. Introduction
    2. Understanding Multiclass Classification
    3. Classifiers in Multiclass Classification
    4. Exercise 9.01: Implementing a Multiclass Classification Algorithm on a Dataset
    5. Performance Metrics
    6. Exercise 9.02: Evaluating Performance Using Multiclass Performance Metrics
    7. Activity 9.01: Performing Multiclass Classification and Evaluating Performance
    8. Class-Imbalanced Data
    9. Exercise 9.03: Performing Classification on Imbalanced Data
    10. Dealing with Class-Imbalanced Data
    11. Exercise 9.04: Fixing the Imbalance of a Dataset Using SMOTE
    12. Activity 9.02: Dealing with Imbalanced Data Using scikit-learn
    13. Summary
  13. Appendix
    1. 1. Data Preparation and Cleaning
    2. Activity 1.01: Addressing Data Spilling
    3. 2. Data Exploration and Visualization
    4. Activity 2.01: Analyzing Advertisements
    5. 3. Unsupervised Learning and Customer Segmentation
    6. Activity 3.01: Bank Customer Segmentation for Loan Campaign
    7. Activity 3.02: Bank Customer Segmentation with Multiple Features
    8. 4. Evaluating and Choosing the Best Segmentation Approach
    9. Activity 4.01: Optimizing a Luxury Clothing Brand's Marketing Campaign Using Clustering
    10. Activity 4.02: Evaluating Clustering on Customer Data
    11. 5. Predicting Customer Revenue Using Linear Regression
    12. Activity 5.01: Examining the Relationship between Store Location and Revenue
    13. Activity 5.02: Predicting Store Revenue Using Linear Regression
    14. 6. More Tools and Techniques for Evaluating Regression Models
    15. Activity 6.01: Finding Important Variables for Predicting Responses to a Marketing Offer
    16. Activity 6.02: Using RFE to Choose Features for Predicting Customer Spend
    17. Activity 6.03: Building the Best Regression Model for Customer Spend Based on Demographic Data
    18. 7. Supervised Learning: Predicting Customer Churn
    19. Activity 7.01: Performing the OSE technique from OSEMN
    20. Activity 7.02: Performing the MN technique from OSEMN
    21. 8. Fine-Tuning Classification Algorithms
    22. Activity 8.01: Implementing Different Classification Algorithms
    23. Activity 8.02: Tuning and Optimizing the Model
    24. Activity 8.03: Comparison of the Models
    25. 9. Multiclass Classification Algorithms
    26. Activity 9.01: Performing Multiclass Classification and Evaluating Performance
    27. Activity 9.02: Dealing with Imbalanced Data Using scikit-learn
    28. Hey!
18.117.183.172