Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Statistics for Machine Learning

You're reading from  Statistics for Machine Learning

Product type Book
Published in Jul 2017
Publisher Packt
ISBN-13 9781788295758
Pages 442 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Pratap Dangeti Pratap Dangeti
Profile icon Pratap Dangeti

Table of Contents (16) Chapters

Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Journey from Statistics to Machine Learning Parallelism of Statistics and Machine Learning Logistic Regression Versus Random Forest Tree-Based Machine Learning Models K-Nearest Neighbors and Naive Bayes Support Vector Machines and Neural Networks Recommendation Engines Unsupervised Learning Reinforcement Learning

HR attrition data example


In this section, we will be using IBM Watson's HR Attrition data (the data has been utilized in the book after taking prior permission from the data administrator) shared in Kaggle datasets under open source license agreement https://www.kaggle.com/pavansubhasht/ibm-hr-analytics-attrition-dataset to predict whether employees would attrite or not based on independent explanatory variables:

>>> import pandas as pd 
>>> hrattr_data = pd.read_csv("WA_Fn-UseC_-HR-Employee-Attrition.csv") 
 
>>> print (hrattr_data.head())

There are about 1470 observations and 35 variables in this data, the top five rows are shown here for a quick glance of the variables:

The following code is used to convert Yes or No categories into 1 and 0 for modeling purposes, as scikit-learn does not fit the model on character/categorical variables directly, hence dummy coding is required to be performed for utilizing the variables in models:

>>> hrattr_data['Attrition_ind...
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 $15.99/month. Cancel anytime}