Predicting Automation from Job Descriptions

Posted on Apr 5, 2016

Contributed by Tomas Kolasa. He took the course in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between January 11th to April 1st, 2016. This post is based on his capstone project Β (due on the 12th week of the program).

For this project, I appliedΒ Frey and Osborne's probabilities of occupation computerization to scraped job description data. Using natural language processing (NLP) and semi-supervised learning, I created a basic model that predicts a job's automatability based on its text description. This model can take in any new job description and return its corresponding probability of automation.

Automation is no new concept. Whether the automation of hand knitters from the invention of the stocking frame knitting machine in the 16th century or the obsolescence of guilds from the development of new technology, there was always a threat that a worker might lose her livelihood. However, with recent exponential advances in computational power and robotics, the economy faces never before seen threats to employment, including for highly cognitive tasks.

BackgroundΒ Source Paper

In 2013, Carl Benedikt Frey and Michael A. Osborne of Oxford published The Future of Employment: How Susceptible are Jobs to Computerisation?. They studied 702 occupations listed by the US Department of Labor and examined each for nine factors determined by the Occupational Information Network (O*NET) database.

Using this database, labor non-susceptible to automation can be represented by the following:

Where is labor entailing perception and manipulation, is labor entailing creative intelligence, and is labor entailing social intelligence. Each of these factors subdividesΒ in the following table from the paper:

variable_table

The team of machine learning researchers next asked, β€œCan the tasks of this job be sufficiently specified, conditional on the availability of big data, to be performed by state of the art computer-controlled equipment.” Using O*NET data on each occupation, they subjectively labeledΒ 70 occupations where a label of 1 corresponds toΒ fully automatable occupations and 0 corresponds to a non-automatable occupation. This probability denotes how easy or difficultΒ it is to automate an occupation, not whetherΒ macroeconomicΒ forces and policy decisions will actually lead to a specific occupation's automation.

After labeling these 70 occupations, the authors used a Gaussian Process Classifier to estimate the probability of automation for the remaining occupations.

For each of the nine O*NET variables, the authors plotted each occupation's variable score with the estimated probability of automation. As the following scatter plots show, there is a lower probability of computerization for occupations with higher scores for assisting/caring for others, persuasion, negotiation, social perceptiveness, artistry, and originality. The opposite is true for the perception and manipulation variables of manual dexterity, finger dexterity, and cramped work space.

frey-osborne_results_scatter

Scraping Job Descriptions

For each of the 702 occupations, I searched a popular public job listing site.Β Since many of the Department of Labor occupations use old terminology, I manually checked the results of each search to monitor quality. To distinguish between similar jobs that may come up in results for differing occupations (such as for dentist vs. dental assistant), I set more detailed search criteria such as job title when possible. Even though this process consumed many hours of time, it was necessary to ensure authenticΒ and actionable results.

Of the original occupations, 569 had search results. As shown in the histogram below, most of those occupations had a very high or low probability of computerization.

count_occupations_by_prob

Although some occupations have many results, I limited the number of descriptions to 1,000 per occupation. I thus had a stratified sample of at most the first 1,000 descriptions per occupation, making a total of 260,000 job descriptions.

Natural Language Processing

To analyze the text, I used the Natural Language Toolkit (NLTK) to remove stop words, tokenize, and stem the text corpus's vocabulary.

To compare the different occupations, I calculated theΒ tf-idf (term frequency–inverse document frequency) of the job descriptions. This metric determines the importance of a word to a document in a collection of documents.Β To use the scikit-learn's implementation of tf-idf in Python, the corpus size was still too large. To speed up the process, I only calculated it forΒ the first 100 job descriptions forΒ eachΒ occupation.

Semi-Supervised Learning

Before modeling, I still had toΒ simplify the problem further. Instead of classifying a job description as belonging to one of the 569Β labeled occupations, I first broke down the occupations into clusters based on the tf-idf vectors for each occupation.

Looking at hierarchical clustering of the occupations using the Ward's method, the dendrogram does not exhibit lopsidedness. This is evidence that clustering the occupations is a valid method. Similar occupations exhibitΒ subjective similarities between them,Β unofficially corroborating agglomerative clustering

Click the dendrogram below toΒ expand in a new tab

dendrogram

Performing k-means clustering over many values of k, there is not a number of clusters thatΒ cleanly groups the data, as shown in the following scree plot of the within-cluster sum of squared errors.

within_cluster_sum_square

Nevertheless, the more important measure for modelingΒ prediction is the probability of automation of the occupations within each cluster. For a cluster to to benefit automation prediction, the occupations within it should all have similar probabilities of automation. If so, I can safely assign a new job description to that cluster and simply give the average automation probability of that cluster.

Looking at many different values ofΒ k, I measured each cluster's standard deviation of automation probability. I then took the weighted average of all the clusters to give more weight for clusters with more occupations in them than others. In the graph below, the standard deviation decreases as the number of clusters increases.

clusters_std

 

I first examined aΒ kΒ of 10Β because that number of clusters or greater coversΒ the most significant dropΒ of within-cluster standard deviations. The clustering results are summarized in the following table:

Cluster Key Words Sample Predicted Occupations Automation
Probability
Stand. Dev.
0 sale, marketing, clients, design, retail Β Fashion Designers, Real Estate Brokers,Β Theatrical and Performance, Marketing Managers,Β Insurance Sales Agents, Telemarketers Β 0.26 Β 0.30
1 machines, tools, machines, manufacturing, materials Machinists, Rolling Machine Setters,Β Coremaking,Β Underground Mining,Β Tool & Die Makers,Β Sawing Machine Setters/Operators,Β Computer-Controlled Machine Tool Operators 0.73 Β 0.17
2 student, volunteer, classroom, volunteer, provided Teachers, Teacher Assistants, Sociologists,Β Librarians, Coaches and Scouts,Β Referees Β 0.28 Β 0.33
3 assemble, manufacturing, metal, tools, fabrication Β Metal/Plastic Engine/Machine Assemblers,Β Electromechanical Equipment Assemblers, Furnace/Kiln/Oven/Drier Operators/Tenders,Β Welding/Soldering/Brazing Machine Setters Β 0.69 Β 0.30
4 guests, clean, food Β Baggage Porters and Bellhops, Gaming Managers, Cooks,Β Massage Therapists, Hotel Desk Clerks Β 0.13 Β 0.22
5 safety, driver, clean, materials, vehicle Locomotive Engineers, Flight Attendants, Embalmers,Β Truck Drivers,Β Refuse and Recyclable Material Collectors,Β Log Graders and Scalers,Β Janitors and Cleaners Β 0.70 Β 0.25
6 engineers, projects, design, data, technical Mechanical Drafters, Petroleum Engineers, Environmental Engineers, Economists, Geoscientists, Β Logisticians, Nuclear Engineers,Β Civil Engineering Technicians, Actuaries Β 0.84 Β 0.22
7 care, medical, health, treatments, physician Β Physical Therapists, Orthodontists,Β Social Workers, Pharmacy Aides, Physicists,Β Dental Laboratory Technicians,Β Psychologists,Β Physicians and Surgeons Β 0.31 Β 0.36
8 office, accounting, process, documents, clients Β Judges,Β Judicial Law Clerks,Β Tax Examiners and Collectors,Β Claims Adjusters/Examiners/Investigators,Β Probation Officers and Correctional Treatment Specialists Β 0.53 Β 0.39
9 repair, maintenance, installation, electrical, technician Β Plant and System Operators,Β Environmental Science and Protection Technicians,Β Plumbers/Pipefitters/Steamfitters,Β Boilermakers,Β Bus and Truck Mechanics 0.83 0.17

Although some clusters, especiallyΒ clusters 4 andΒ 9, do aΒ goodΒ job of grouping occupations with similar probabilities of automation, others make some mistakes. For example,Β there is a 0.99 probability that employers can automate telemarketers when the clustering groupsΒ telemarketers into cluster 0 with a 0.26 probability of computerization.

This is partially due to the nature of clustering along probabilities between 0 to 1.Β For clusters with average probabilities near 0 or 1, the observations of aΒ clusterΒ have a smaller variance of automation probabilities because a single occupation's probability cannot be less than 0 or greater than 1. This relationship is shown in the following graphs for 10, 20, and 50 clusters. This means clusters with very low or very high probability of automation haveΒ more exact predictions.

std_vs_mean_10cluster

std_vs_mean_20cluster std_vs_mean_50cluster

 

Fitting a Model and Making Predictions

To fit job descriptions, I used a NaΓ―ve Bayes Classifier.Β Since the main assumption of NaΓ―ve Bayes is independence of features, the model assumes the occurrence of any twoΒ words is independent and that the location of a word is independent of its occurrence in the document. The model classifies a job in a cluster and I assign that cluster's probability of automation to that job.

To run the model on a new job description, I first must calculate itsΒ tf-idfΒ vector. I then use my classification model to find the most appropriate cluster for the new job description. I then take that cluster's probability of automation and return it as the predicted probability of automation of the new job description. I made it into the final function below:

def job_automation_predictor(description):
    features_test = tfidf_vectorizer.transform([description])
    cluster = clf.predict(features_test.toarray())[0]
    print ('Cluster', cluster)
    print ('Probability of automation:', groupedc10.mean()[cluster])
    print ('Automation standard deviation:', groupedc10.std()[cluster])
    print ('Key words:',key_words['Cluster ' + str(cluster)])

 

For example, the following new job description of a Facility Maintenance Technician has its corresponding function output below:

Commercial and residential property management company is currently looking for mid level facility maintenance technicians. Candidates will be responsible for: Keeping grounds clean. Basic janitorial duties. Keeping exterior area’s trimmed and mowed. Hanging seasonal decorations and lighting. Operating forklifts. Basic HVAC experience required. Desired Skills and Experience Must have a valid drivers license. Pre-employment drug screen and background check required.

Cluster 9
Probability of automation: 0.826296296296
Automation standard deviation: 0.171808321193
Key words:repair, maintenance, installation, electrical, technician

While the model gives a logical classification for this job, others descriptions do not always fare so well. There is still plenty of room for improving the model, especially byΒ tuning the tf-idf parameters. Running the models with more data will be more time-consuming, but will hopefully gather more accurate insights for prediction.Β After tuningΒ the model in the coming weeks, I plan to build a web application where a user can input anyΒ job description to better understand itsΒ risk of automation.

Although I would like to conclude on an optimistic note about how artificial intelligence will greatly improve overall economic productivity, that would not do justice to the millions of citizens who will face threats to their livelihoods unless governments work to greatly overhaul labor educationΒ and training.

Β 

About Author

Thomas Kolasa

After working in econometric consulting, Thomas began learning programming in order to pursue data science: the perfect combination of his interests in computer science, statistics, and business strategy. Thomas earned his B.A. in economics from Harvard University where...
View all posts by Thomas Kolasa >

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI