Using Machine Learning to Improve Sales - A Simple Example 

You've probably heard by now about all of the advances machine learning is enabling, in areas like voice recognition, conversations, image processing, and self-driving cars. But how can you harness this amazing new power to do something as basic as improve your business's sales? What level of work is required, and what kind of results can you expect to achieve?

This blog article sets out to answer these questions by giving a concrete, real-world example: improving the close rate of an outbound sales team.

You don't need to be a machine learning expert to understand the example I will give. I'll take you through the whole process at a high level, and summarize the results. And for the programmers out there, I'll include the data and sample code.

The first thing you'll need in order to work on any machine learning problem is historical data - the more the better. Even basic machine learning algorithms require hundreds or thousands of data points to achieve reasonable accuracy; some algorithms like neural networks can require millions.

For most (supervised) learning algorithms, the historical data has to be tagged with the "correct" answer. For example, if you are trying to train your algorithm to recognize faces in a picture, you need to start with data where the people are already tagged. Similarly, in our case, where we are trying to predict whether or not a sales lead will purchase our product, we need historical data on prior leads, their attributes, and whether or not they purchased the product. The goal of the machine learning code is then to predict which ones will purchase the product in the future.

I googled for some sample data and found a data set of 3000 sales records that were generously provided by a Portuguese bank and used as the basis of a kaggle competition. This data includes 3000 of their leads, and for each, it has about a dozen attributes (age, education, profession, etc) as well as whether or not the lead purchased the product they were telemarketing (a term deposit). 

I randomly pulled out about 10% of these leads and set them aside as part of a "test set". Once the algorithm is trained, we will test it by applying the predictions to this test set, and, by comparing our predictions to what actually happened, we will be able to see how accurate our predictions were.

The remaining data was used to train the algorithm.

In practice, the first choice you would make regarding the algorithm is what platform to use to develop it. Theoretically, you can write your algorithm from scratch, use a pre-built library like tensorflow, or use a development environment geared to developing and deploying machine learning models like Amazon Sagemaker. I chose the last option as this is the easiest and also in general the Amazon algorithms are scalable and efficient. Sagemaker uses convenient Jupyter notebooks (a popular development environment for python/ML) and also works directly on the AWS cloud with ample computing resources available - important for the training part of the process, which can consume a lot of computer resources.

The next choice you might make is what machine learning algorithm to use. There are about a dozen popular machine learning algorithms (cheat sheet here), each one tuned to a particular type of problem and data set. The one I chose is XGBoost (a form of gradient boosted tree), which works very well for classification problems (where the answer is one of  limited set of values, like "yes" or "no", as opposed to a number) and does not require a huge data set. In my case, I had ~2700 record to train with, and just needed to predict "yes" or "no", whether they would buy the product or not.

With Sagemaker, once you have the data set up the way you want it, actually doing the machine learning training is just a few lines of code. You simply pass off the data to an XGBoost training implementation and it trains a model for you. In my case, this took about 15 minutes of execution time. This "model" is essentially a predictor function that will allow you to predict future sales. AWS lets you easily set this up as an endpoint that is easily callable from your code.

The whole process took me 3-4 hours, most of which was cleaning up the data beforehand. 

What were the results?

  • Without using machine learning, and just calling every lead on the list, the close rate would have been 7.5%.
  • With using machine learning, and just calling the leads it predicts would close, the close rate would have been 85%.

In other words, even with this simple example, relatively small data set, and no model tuning, sales close rates with machine learning were over 11 times higher than without it.

With more work, It's possible to improve it even further.

Hopefully this example gives you a sense of the power of machine learning, and how it can be used in real world problems all business face.

Here is the code for those that are curious. You should be able to run this directly in a Sagemaker Jupyter notebook.

The same data used is here.

bucket = 'marketing-example-1'
prefix = 'sagemaker/xgboost'
# Define IAM role
import boto3
import re
from sagemaker import get_execution_role

role = get_execution_role()

#import libraries
import numpy as np                                # For matrix operations and numerical processing
import pandas as pd                               # For munging tabular data
import matplotlib.pyplot as plt                   # For charts and visualizations
from IPython.display import Image                 # For displaying images in the notebook
from IPython.display import display               # For displaying outputs in the notebook
from time import gmtime, strftime                 # For labeling SageMaker models, endpoints, etc.
import sys                                        # For writing outputs to notebook
import math                                       # For ceiling function
import json                                       # For parsing hosting outputs
import os                                         # For manipulating filepath names
import sagemaker                                  # Amazon SageMaker's Python SDK provides many helper functions
from sagemaker.predictor import csv_serializer    # Converts strings for HTTP POST requests on inference

#download data set

#read into data frame
data = pd.read_csv('./data.csv', sep=',')
pd.set_option('display.max_columns', 500)     # Make sure we can see all of the columns
pd.set_option('display.max_rows', 20)         # Keep the output on one page

#clean up data
data['no_previous_contact'] = np.where(data['pdays'] == 999, 1, 0)                                 # Indicator variable to capture when pdays takes a value of 999
data['not_working'] = np.where(np.in1d(data['job'], ['student', 'retired', 'unemployed']), 1, 0)   # Indicator for individuals not actively employed
model_data = pd.get_dummies(data)                                                                  # Convert categorical variables to sets of indicators
model_data = model_data.drop(['duration', 'emp.var.rate', 'cons.price.idx', 'cons.conf.idx', 'euribor3m', 'nr.employed'], axis=1)

#split into train, test, validation sets
train_data, validation_data, test_data = np.split(model_data.sample(frac=1, random_state=1729), [int(0.7 * len(model_data)), int(0.9 * len(model_data))])   # Randomly sort the data then split out first 70%, second 20%, and last 10%

#prep for XGBoost
pd.concat([train_data['convert_yes'], train_data.drop(['convert_no', 'convert_yes'], axis=1)], axis=1).to_csv('train.csv', index=False, header=False)
pd.concat([validation_data['convert_yes'], validation_data.drop(['convert_no', 'convert_yes'], axis=1)], axis=1).to_csv('validation.csv', index=False, header=False)

#copy to S3
boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'train/train.csv')).upload_file('train.csv')
boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'validation/validation.csv')).upload_file('validation.csv')

#set up training instances
containers = {'us-west-2': '',
              'us-east-1': '',
              'us-east-2': '',
              'eu-west-1': '',
              'ap-northeast-1': ''}

s3_input_train = sagemaker.s3_input(s3_data='s3://{}/{}/train'.format(bucket, prefix), content_type='csv')
s3_input_validation = sagemaker.s3_input(s3_data='s3://{}/{}/validation/'.format(bucket, prefix), content_type='csv')

#create training job
sess = sagemaker.Session()

xgb = sagemaker.estimator.Estimator(containers[boto3.Session().region_name],
                                    output_path='s3://{}/{}/output'.format(bucket, prefix),
                        num_round=100){'train': s3_input_train, 'validation': s3_input_validation}) 

#create an endpoint based on trained model
xgb_predictor = xgb.deploy(initial_instance_count=1,

#evaluate results
xgb_predictor.content_type = 'text/csv'
xgb_predictor.serializer = csv_serializer
def predict(data, rows=500):
    split_array = np.array_split(data, int(data.shape[0] / float(rows) + 1))
    predictions = ''
    for array in split_array:
        predictions = ','.join([predictions, xgb_predictor.predict(array).decode('utf-8')])

    return np.fromstring(predictions[1:], sep=',')

predictions = predict(test_data.drop(['convert_no', 'convert_yes'], axis=1).as_matrix())

pd.crosstab(index=test_data['convert_yes'], columns=np.round(predictions), rownames=['actuals'], colnames=['predictions'])

#clean up
Posted by Brian Conte Monday, July 2, 2018 2:34:00 AM Categories: B2B big data technology

Big Data - A Sample Application 

Exploring Google Books

Google Books, and its associated ngram indices, represent one of the largest publicly available databases in the world. At last count, Google had scanned and indexed over 25 million books containing over 1,000,000,000,000 terms (ngrams) - roughly comparable to all of the text on all of the pages of the internet. Not only is the database impressive in its scale and availability, but in the wealth of knowledge in it about our culture over the last 200 years. 

Here are some examples of some of the insights you can gain with Google Books. These graphs show the relative occurrences in printed material of the specified words and phrases, by year, and to a good approximation reflect what people were thinking (and writing about) during this time.

Political ideologies:


Modes of transportation:

Family roles:

Many more examples are here.

Working with data sets this large required Google to pioneer new concepts in highly scalable parallel data processing, such as MapReduce, also known by the name of its popular implementation, Hadoop. These techniques allowed Google to break down the massive problem of indexing this vast database into manageable chunks that could be performed by many machines working in parallel. These systems and techniques are now used by many companies for big data problems, such as customer analytics and machine learning. 


View User Profile for Brian Conte Brian founded Fast Track with over 15 years of entrepreneurial experience and technology expertise. Brian managed the development of Microsoft's first browser in 1985 and later founded hDC, the first Windows software company. Brian ran hDC, later named Express Systems, for 10 years before selling it to WRQ in 1996, where he remained as CTO. Brian spearheaded the development of one of WRQ's most successful products, Express 2000, which generated more than $10 million in its first year. Brian holds a BSE in Electrical Engineering and Computer Science from Princeton University.
Posted by Brian Conte Tuesday, October 18, 2016 1:31:00 AM Categories: B2B big data custom development enterprise technology web development

In-House or Outsourced Web Development: Which is Better? 

There’s so much debate about which is better, between hiring in-house developers and outsourcing web development. Some business owners say that they find hiring in-house developers better than getting help from outside the company. But others think differently. This issue has left some small business owners in a quandary which can roadblock operations and threaten ROI.

in-house or outsource web developmentWhile there are many business owners raving about the benefits out of outsourcing work overseas, others see it differently. Below are significant reasons why some want to get their work done in-house.

The Benefits of Hiring-In-House Developers

  • Buy in and not Bail out: People who work within the company are likely to invest time and energy and may often share in company equity plans. This motivates them to stay as a long-term company asset.
  • Hands-on: In-house developers are aware of the various areas the business engages in and capable of offering possible solutions that an external team may not see.                        
  • Aligned with the Company’s Interests: Normally, a regular employee has a mindset aligned to the company he is working with. This means those employed in-house help in building greater revenues because they know that if the company prospers, they will likewise get their own share of success.                                  
  • Controlled Time, Activity and Quality: The company can take control of all activities, quality, and time of in-house personnel. Some business owners feel that they can cut the cost if they use inside talent as the process of requesting for skilled external resources costs more. There are companies that are blessed with outstanding teams that do not require hiring additional help.


  • Cost: In general, in-house developers are more expensive than outsourced developers, often by a factor of two or more.
  • Hiring Woes: It’s hard and takes longer to find qualified outsourced expertise, and the longer you wait, the more frustrated you get.
  • Knowledge: Using in-house developers means building up in-house knowledge and expertise, which can take significant time and efforts.

So why do people outsource web development overseas instead of using those that are within arm’s length? Outsourcing is getting the services of consultants, an agency, or a service provider that can manage some portions of a company’s business.

Reasons for outsourcing vary; it could be cost, capacity, or it may be that the company is looking for specialized skills, special equipment a startup company has, or the business only requires limited, temporary, or seasonal resources.

The Benefits of Outsourcing Web Development

  • Special Skills, Specialized Equipment: The success of online websites depends on graphics design, PPC campaigns, website development, and many others. These require special skills and special equipment that companies outside the web development industry typically don’t have in place. These can be done by outside experts who can be tasked to do, including accounting and human resource management.
  • Scalable Capacity: With outsourcing, you only easily scale your development team to the size needed, improving throughput while streamlining costs.
  • Short-Term Commitment: Infrastructure and website upgrading, as well as graphic design are temporary, seasonal or limited needs. By outsourcing you pay for these services only when they are needed.

You may hire another set of minds with different skillsets when another need arises. Hiring short-term saves you from committing to annual salaries and benefits.

  • Lower Cost: Local developers get paid more than outsourced online workers and this is another reason why many entrepreneurs opt to outsource help. Paying half the cost to outsourced skilled individuals is a welcome idea for those who are just starting up.
  • Good Values through Competition:  With so many outsourcing contractors waiting to be tapped, skilled workers employed in these companies strive hard to outdo the others. This provides assurance to companies looking to hire experts as they would be getting the better if not the best hires to work for their cause.


  • Availability: Demand for skilled developers has soared high in the recent years which made experts in this field harder to find. These people are so busy tending to different clients and their availability is scarce.  This calls for being resourceful at choosing service providers to catch up with your deadlines.
  • Language and Cultural Barriers: While there are so many experts from outsourcing companies, there is a great possibility that communication can be difficult. You need time to converse with them on some important aspects but at times, it is difficult to bridge the language gap. You can get help from countries that speak the same language you do.
  • Loss of Knowledge: Using outsourced developers often means knowledge is accrued and maintained outside the organization, and can be substantially lost if there is no relationship with the external development team. What your outsourced workers know cannot be shared with the team, which means lesser internal growth for the company.
  • Ramp up Time: The time between product or software development and capacity utilization may vary due to several reasons. If this happens, there is no control over implementation. So, if an outsourced company cannot deliver on time, expect a delay in your revenues.
  • Management Time: In-house workers can get familiarized with the systems they manage quickly because managing tasks on a personal basis is quite possible. Outsourcing can fail on this area as they do not come face to face with the problems themselves.
  • Greater Risk: Before deciding on outsourcing IT services, running a background check on your shortlisted companies is a good idea. Not all foreign countries have the same security protocols your country has so there is always a risk in terms of private data or intellectual property handling.

Hiring in-house developers has a number of advantages but outsourcing is often a better option for growing companies. While other businesses look at hiring in-house as more ideal, the fact remains that technical expertise and communication skills could break the tie as to what a company really needs.

Have you outsourced some parts of your web development, or other business processes? Do you prefer to have a face-to-face interaction with your employees? Feel free to share your thoughts in the comments section below.

View User Profile for Brian Conte Brian founded Fast Track with over 15 years of entrepreneurial experience and technology expertise. Brian managed the development of Microsoft's first browser in 1985 and later founded hDC, the first Windows software company. Brian ran hDC, later named Express Systems, for 10 years before selling it to WRQ in 1996, where he remained as CTO. Brian spearheaded the development of one of WRQ's most successful products, Express 2000, which generated more than $10 million in its first year. Brian holds a BSE in Electrical Engineering and Computer Science from Princeton University.
Posted by Brian Conte Friday, September 16, 2016 3:33:00 PM Categories: business partnership content development custom development web development website

How Site Evaluator Metrics Saves You Time and Money 

A website owner like you can be beset with various problems from day the day your website is up and running. This is because there are technological aspects of your business website that you have to be aware of when managing your online presence. Even though your content and images appeal easily to website visitors, there is a need to know if your business is faring well with competitors and if it is really patronized by many.

As we all know, a website is a huge investment in time, effort and money. Some small business owners hire the best teams to learn how the Internet can bring them good financial status as they know that they are not quite familiar with how several online processes work. These are people who are bent on taking back what they have cashed out the surest way possible.

With processes, we mean there is really an enormous list with which ordinary people are not familiar. So, if you are still trying to find out where you have gone amiss, then, most likely, you have been losing money already. You don’t need to panic. There are easy ways you can use to get your desired business outcome in time which requires effort and patience.

Why evaluating your website saves you time and money?

Website evaluation is the ultimate means of accelerating your online business success as it helps you understand why visitors are either flocking or fleeing your website. Fast Track’s Site Evaluator uses several metrics to evaluate your site’s ability to draw in people. If continually monitored and results are intelligently analyzed, your business is set to receive higher revenues using the shortest possible time.

Without knowing which way your site is going can be devastating to your purse that’s why Site Evaluator was developed to help you with this major issue.

Advantages of Using the Site Evaluator

There are several reasons why this website evaluator can make you save on time and money. It helps your business website the following:

Site Accessibility: There are sites that seem to deprive individuals who have disabilities like auditory or verbal, visual, neurological or cognitive deficiencies; include those who have temporary impediments as well. These people also like to visit websites to learn new technologies that can add to their knowledge. Using W3C and alternative text to create easy navigation would mean no visitor is lost and additional visitors for competing websites can be trimmed down.

Website Performance: A slow loading site drives away possible earning opportunities and creates negative impact on a company’s reputation. Images that are too big and placing unnecessary codes on the pages challenge the way your site behaves when clicked. If this happens, visitors are turned away just like turning away future revenues. Site Evaluator will tell you if there is a need to compress image sizes or weed out broken links.

Social Media Optimization: There are more than a couple of ways to improve your online presence and many have depended on social media to optimize their websites as well. But not all business owners know how they rate when it comes to this category. So, if you fail in this department, we would be the first ones to know. We will see to it that all social networking sites would partake of your content by means of integrating into your site all social networking buttons and see to it that there are no broken links.’

Site Availability: An ideal site responds to users at any time and that means continuous flow of business. Although no website can promise to cater to its users 24/7, Site Evaluator says being available for a little less than 100% is fair enough. We measure a site’s availability by means of the entire of number of days in a year it is on and by the web hosting company it is associated with. This guarantees good availability score for your online business.

Website Security: Security is imperative for a website so as to protect its users and to cultivate trust and loyalty. It also reinforces website rankings because if more users see that their information details are safe from hackers, more users will feel secure to share their information in your website forms.  This is paramount if you are an eCommerce site and requires users to fill in online payment forms. Greater customer trust means happy customers. Happy customers would likely mean repeat orders from you and/or refer you to their friends and families. 

Site Support: A website that has full customer support creates a more loyal audience. Customers expect their issues or even the simplest questions are addressed fast and easy. Several websites lack contact forms, chat support pop-ins or forums that can provide the right solutions anytime of the day. Site evaluator measures your site by means of feedback or communication between you and your customers.

Marketing Metric: As majority of websites that exist today function as marketing tools, there is a need to maximize effectiveness through the use of various industries’ best practices like creating active blogs and integration of social media among others. Site Evaluator assesses your marketing metrics via lead generation, mobile, SEO, blogging, and Social media scores. If you don’t have forums, blogs or RSS feeds, and most especially, an integrated social media, then, expect to get a low score on this category.

Search Engine Optimization: Websites that have good search engine rankings get the most number of viewers and customers alike.  Without effective keywords, descriptions or meta-tags, you can never compete with others who have this capability. Site Evaluator helps you see where your site is at and makes you know the difference between an entirely optimized site and one that is haphazardly done.

Site Usability: To optimize usability, your site must have a search function to make it easy-to-use and convenient for your visitors. This makes them find the right kind of product that you are selling or the type of service they are looking for. If not, possible buyers will tend to abandon your site and transfer to another that can offer them ease. Always remember that online competition is stiff and a flick of a finger can change the course of your website’s financial status. Our company can suggest ideas that may cause your business topple others after learning where you have committed a blunder.

As nothing comes for free these days, you can get a good bargain even though you’d pay more in getting the services of experts. But while not all experts are excellent in this field, we can assure you that all benefits will be yours once you have tried our Site Evaluator. We know how much you need this tool and we know that by helping you implement it on your site, you would come close to becoming a successful online business entrepreneur in the long haul. And what else? It’s totally FREE!

View User Profile for Crista McCandless Crista is a self-proclaimed geek who loves fiction, data analysis, growth hacking and everything Tolkien. At Fast Track, she helps businesses identify areas to improve and grow online with her ninja moves. She manages the digital strategy, including online marketing and search engine optimization. Follow her musings about world domination in Twitter as @crista_mcc.
Posted by Crista McCandless Monday, June 20, 2016 10:03:00 AM Categories: marketing tips Site Evaluator web trends

[Infographic] Social Media Image Size Cheat Sheet 2016 

'Cause it's nifty to have them all in one place, ain't it?

Almost every month a new startup launches and new technology is introduced. The internet universe is always changing. Now, how does it impact you and your business? Well, in an age where social media has become an integral part of how we market our products and services online, we have to stay updated to remain relevant. You have to be sure to continually employ best practices. For example, researchers found out that color increases motivation to read content by 80%, so it is then imperative that marketing and social media contents be paired with images that reinforce information retention. In fact, Facebook posts that included images earned 87% of all engagements. This is an important piece of information all small businesses must take advantage of.

To help you accelerate your online success, we compiled this year's newest and most updated sizes of social media images.

social media images cheat sheet for 2016

If you like this infographic, go ahead and share it with a friend.

View User Profile for Crista McCandless Crista is a self-proclaimed geek who loves fiction, data analysis, growth hacking and everything Tolkien. At Fast Track, she helps businesses identify areas to improve and grow online with her ninja moves. She manages the digital strategy, including online marketing and search engine optimization. Follow her musings about world domination in Twitter as @crista_mcc.
Posted by Crista McCandless Wednesday, May 25, 2016 4:31:00 PM Categories: social media social media marketing web trends
Page 1 of 33 1 2 3 4 5 6 7 8 9 10 20 30 > >>