Book description
Gain hands-on experience with industry-standard data analysis and machine learning tools in Python
Key Features
- Tackle data science problems by identifying the problem to be solved
- Illustrate patterns in data using appropriate visualizations
- Implement suitable machine learning algorithms to gain insights from data
Book Description
Data Science Projects with Python is designed to give you practical guidance on industry-standard data analysis and machine learning tools, by applying them to realistic data problems. You will learn how to use pandas and Matplotlib to critically examine datasets with summary statistics and graphs, and extract the insights you seek to derive. You will build your knowledge as you prepare data using the scikit-learn package and feed it to machine learning algorithms such as regularized logistic regression and random forest. You'll discover how to tune algorithms to provide the most accurate predictions on new and unseen data. As you progress, you'll gain insights into the working and output of these algorithms, building your understanding of both the predictive capabilities of the models and why they make these predictions.
By then end of this book, you will have the necessary skills to confidently use machine learning algorithms to perform detailed data analysis and extract meaningful insights from unstructured data.
What you will learn
- Install the required packages to set up a data science coding environment
- Load data into a Jupyter notebook running Python
- Use Matplotlib to create data visualizations
- Fit machine learning models using scikit-learn
- Use lasso and ridge regression to regularize your models
- Compare performance between models to find the best outcomes
- Use k-fold cross-validation to select model hyperparameters
Who this book is for
If you are a data analyst, data scientist, or business analyst who wants to get started using Python and machine learning techniques to analyze data and predict outcomes, this book is for you. Basic knowledge of Python and data analytics will help you get the most from this book. Familiarity with mathematical concepts such as algebra and basic statistics will also be useful.
Table of contents
- Preface
- Chapter 1:
-
Data Exploration and Cleaning
- Introduction
- Python and the Anaconda Package Management System
- Different Types of Data Science Problems
-
Loading the Case Study Data with Jupyter and pandas
- Exercise 2: Loading the Case Study Data in a Jupyter Notebook
- Getting Familiar with Data and Performing Data Cleaning
- The Business Problem
- Data Exploration Steps
- Exercise 3: Verifying Basic Data Integrity
- Boolean Masks
- Exercise 4: Continuing Verification of Data Integrity
- Exercise 5: Exploring and Cleaning the Data
- Data Quality Assurance and Exploration
- Exploring the Financial History Features in the Dataset
- Summary
- Chapter 2:
-
Introduction to Scikit-Learn and Model Evaluation
- Introduction
- Exploring the Response Variable and Concluding the Initial Exploration
- Introduction to Scikit-Learn
-
Model Performance Metrics for Binary Classification
- Splitting the Data: Training and Testing sets
- Classification Accuracy
- True Positive Rate, False Positive Rate, and Confusion Matrix
- Exercise 9: Calculating the True and False Positive and Negative Rates and Confusion Matrix in Python
- Discovering Predicted Probabilities: How Does Logistic Regression Make Predictions?
- Exercise 10: Obtaining Predicted Probabilities from a Trained Logistic Regression Model
- The Receiver Operating Characteristic (ROC) Curve
- Precision
- Activity 2: Performing Logistic Regression with a New Feature and Creating a Precision-Recall Curve
- Summary
- Chapter 3:
-
Details of Logistic Regression and Feature Exploration
- Introduction
- Examining the Relationships between Features and the Response
-
Univariate Feature Selection: What It Does and Doesn't Do
- Understanding Logistic Regression with function Syntax in Python and the Sigmoid Function
- Exercise 13: Plotting the Sigmoid Function
- Scope of Functions
- Why is Logistic Regression Considered a Linear Model?
- Exercise 14: Examining the Appropriateness of Features for Logistic Regression
- From Logistic Regression Coefficients to Predictions Using the Sigmoid
- Exercise 15: Linear Decision Boundary of Logistic Regression
- Activity 3: Fitting a Logistic Regression Model and Directly Using the Coefficients
- Summary
- Chapter 4:
-
The Bias-Variance Trade-off
- Introduction
-
Estimating the Coefficients and Intercepts of Logistic Regression
- Gradient Descent to Find Optimal Parameter Values
- Exercise 16: Using Gradient Descent to Minimize a Cost Function
- Assumptions of Logistic Regression
- The Motivation for Regularization: The Bias-Variance Trade-off
- Exercise 17: Generating and Modeling Synthetic Classification Data
- Lasso (L1) and Ridge (L2) Regularization
- Cross Validation: Choosing the Regularization Parameter and Other Hyperparameters
- Summary
- Chapter 5:
-
Decision Trees and Random Forests
- Introduction
-
Decision trees
- The Terminology of Decision Trees and Connections to Machine Learning
- Exercise 19: A Decision Tree in scikit-learn
- Training Decision Trees: Node Impurity
- Features Used for the First splits: Connections to Univariate Feature Selection and Interactions
- Training Decision Trees: A Greedy Algorithm
- Training Decision Trees: Different Stopping Criteria
- Using Decision Trees: Advantages and Predicted Probabilities
- A More Convenient Approach to Cross-Validation
- Exercise 20: Finding Optimal Hyperparameters for a Decision Tree
- Random Forests: Ensembles of Decision Trees
- Summary
- Chapter 6:
-
Imputation of Missing Data, Financial Analysis, and Delivery to Client
- Introduction
- Review of Modeling Results
-
Dealing with Missing Data: Imputation Strategies
- Preparing Samples with Missing Data
- Exercise 22: Cleaning the Dataset
- Exercise 23: Mode and Random Imputation of PAY_1
- A Predictive Model for PAY_1
- Exercise 24: Building a Multiclass Classification Model for Imputation
- Using the Imputation Model and Comparing it to Other Methods
- Confirming Model Performance on the Unseen Test Set
- Financial Analysis
- Financial Conversation with the Client
- Exercise 25: Characterizing Costs and Savings
- Activity 6: Deriving Financial Insights
- Final Thoughts on Delivering the Predictive Model to the Client
- Summary
-
Appendix
- Chapter 1: Data Exploration and Cleaning
- Chapter 2: Introduction to Scikit-Learn and Model Evaluation
- Chapter 3: Details of Logistic Regression and Feature Exploration
- Chapter 4: The Bias-Variance Trade-off
- Chapter 5: Decision Trees and Random Forests
- Chapter 6: Imputation of Missing Data, Financial Analysis, and Delivery to Client
Product information
- Title: Data Science Projects with Python
- Author(s):
- Release date: April 2019
- Publisher(s): Packt Publishing
- ISBN: 9781838551025
You might also like
book
Data Science Projects with Python - Second Edition
Gain hands-on experience of Python programming with industry-standard machine learning techniques using pandas, scikit-learn, and XGBoost …
book
Practical Data Science with Python
Learn to effectively manage data and execute data science projects from start to finish using Python …
book
Getting Started with Streamlit for Data Science
Create, deploy, and test your Python applications, analyses, and models with ease using Streamlit Key Features …
book
Machine Learning with Python Cookbook
This practical guide provides nearly 200 self-contained recipes to help you solve machine learning challenges you …