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 "verification set". Once the algorithm is trained, we will test it by applying the predictions to this verification 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
!wget https://fasttrackteam.com/Data/sites/1/media/data.csv

#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
data

#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': '433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest',
              'us-east-1': '811284229777.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest',
              'us-east-2': '825641698319.dkr.ecr.us-east-2.amazonaws.com/xgboost:latest',
              'eu-west-1': '685385470294.dkr.ecr.eu-west-1.amazonaws.com/xgboost:latest',
              'ap-northeast-1': '501404015308.dkr.ecr.ap-northeast-1.amazonaws.com/xgboost:latest'}

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],
                                    role, 
                                    train_instance_count=1, 
                                    train_instance_type='ml.m4.xlarge',
                                    output_path='s3://{}/{}/output'.format(bucket, prefix),
                                    sagemaker_session=sess)
xgb.set_hyperparameters(max_depth=5,
                        eta=0.2,
                        gamma=4,
                        min_child_weight=6,
                        subsample=0.8,
                        silent=0,
                        objective='binary:logistic',
                        num_round=100)

xgb.fit({'train': s3_input_train, 'validation': s3_input_validation}) 

#create an endpoint based on trained model
xgb_predictor = xgb.deploy(initial_instance_count=1,
                           instance_type='ml.m4.xlarge')

#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
sagemaker.Session().delete_endpoint(xgb_predictor.endpoint)
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

10 Reasons Why You Should Be Outsourcing Your Business Now 

business outsourcingOutsourcing has become one of the most important success strategies for small businesses. Years ago, this process was not fully understood and adopted by smaller businesses and entrepreneurs due to fear, and it were only huge corporations that used outsourced work.

These days, you will find more and more SMEs and individual entrepreneurs using outsourcing as a means of meeting business goals and accomplishing more tasks as their businesses grow. If you are thinking of outsourcing for the first time and still not seeing it as a strategy on a business standpoint, here are some of the main reasons why you should go for it.

1. You can save a lot of time. As business owner, focusing and spending time on core business tasks should be your priority, instead of doing tedious ones that can be delegated. Let's face it; there are tasks that eat up a ton of our time even if they are not directly impacting our business as a whole. Multi-tasking is often the solution that others think of, when it's time to speed things up. But studies show that multi-tasking decreases productivity and increases stress.

At the end of the day, it's about completing specific tasks that you should not be doing yourself. If you take on all of the tasks, you might not finish all of them within the day. So why not hire someone who has the skill to do it instead? This way, you can focus on your customers and key responsibilities while your outsourced staff takes care of completing other tasks that are also crucial to your business.

2. Hire experts. When you are running your own small business, it’s impossible to be an expert in every facet of the business. Why not hire people who are? Someone who specializes in the task you want done can not only do it better, they can often do it faster and cheaper as well.

3. Get a fresh, outside perspective. Hiring an outsourced professional can also bring in a fresh new outlook to your business and strategies. You can get new ideas that you wouldn't have thought of yourself and make use of them to improve the way you market your business, for example.

These perspectives come from different experiences, skill level, and involvement of the outsourced individual. When you give this person a chance to collaborate with your in-house team, they can share what they know and learn from each other's insights. Collectively, these insights can bring in fresh new ideas, solutions, and strategies that can help your business in the long run.

4. Leverage expertise on a global basis. If you don’t outsource, you are limited to the local labor pool for human resources. Multinational companies have long enjoyed the benefits of a worldwide knowledge base and teams of professional experts. You don't have to be a huge company to tap and leverage into world-class capabilities. You simply provide the platform and the tasks or projects for your global staff, and let them collaborate with your in-house teams.

5. Reduce stress and improve productivity. Delegating tasks which can free you up is more productive and efficient, rather than doing everything yourself. To some, it is an added expense because adding people into your company means paying extra heads for tasks done. However, in the long run, you will realize that things can only be accomplished sooner if there are a few experts helping out. And instead of spending time finishing tasks, you could use those extra hours in making more sales and getting more customers.

6. Increase your agility and flexibility. It is difficult to juggle tasks and responsibilities as a business owner. But with an outsourced team of skilled professionals, it is easier to keep up with the fast-changing business landscape and improve your business reach.

7. Gain access to specific technologies. When you hire outsourced professionals, it's not surprising to find that many of them are either familiar or using some of today's latest tools and apps. This can be the result of having to work with various companies in different industries which provided them access to the latest tools they use. This can help you in discovering and using whatever latest technology is out there that can specifically benefit your projects and company overall.

8. Save money. Lower operational cost is among the major concerns and goals of SMEs. You don't need a big office in a city's high-rise building and paying for operational costs when you hire skilled professionals from all over the globe. And when properly executed, outsourcing skilled and experienced people has its crucial impact on your business's revenue and savings.

9. Minimize risk. Businesses carry certain amount risks. Competition, financial conditions, markets, technologies, and government policies change quite rapidly. Outsourcing professionals assume and manage these risks for the businesses they partner with, and generally, they make better decisions on how to avoid risks in their areas of expertise.

10. Facilitate fast growth. Outsourcing specific functions of your business to a specialty skilled professional is a strategic decision which can bring savings, improves process efficiencies, and enhances the quality of information, facilitating better decision-making, while alleviating the bottlenecks related to business growth.

Are you outsourcing some of your business functions?

What benefits have you enjoyed so far?

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, February 5, 2016 8:55:00 PM Categories: B2B B2C business partnership

SMB Tips: 15 Social Media Mistakes Brands Need To Avoid 

Knowing what social media marketing is not enough. Understanding how it works is the main menu for your online success. Here's 15 social media mistakes some businesses tend to overlook and how you can avoid them.

Social Media Mistakes Brands Need To Avoid

If you’re a smart marketer, one strategy that you’re probably using to attract new customers is social media.  When done right, social media  becomes a means to connect and engage with targeted customers through sharing useful content, as well as information about your products or services.

However, there are still many businesses that just don't get it right when it comes to social media marketing. As a result, the incurred social media mistakes they've made become time-wasters, or worst, lost profit.

Below is a list of social media mistakes that you may be doing unknowingly:

(1) You have no plan

Before launching any tactic using social media, take a look at your objectives.. You should define your target audience, research your competition, select the right tools of the trade, and produce content before you post your first social media update. Without planning, you might end up appearing disorganized and unprepared.

(2) Going solo

If you have a business that needs a couple of people in order to work, it's the same with your social media campaigns. You don't have to have a separate team, but at least one or two people handling the tasks of strategizing, planning, creating content and design, promotion, branding, and monitoring. Doing it alone is not only stressful, but can also be chaotic.

(3) Being predictable with your content

It's not fun seeing the same updates over and over again on all of your social media accounts. Without creativity and careful thought in your content, your followers may end up clicking the 'unlike' or 'unfollow' button.

(4) Can't write?

Social media updates are not as long as a blog post. These updates should be professionally written, with the audience in mind, and with a dash of creativity and wit to capture their attention. If you can't do this, hire a professional writer who can channel the right tone and provide quality content consistently.

(5) Not posting updates in real-time

While it's okay to schedule updates on social media, it's not as engaging as a real-time updates that have commentaries instantaneously. Not sharing content in real-time may even deter your target audience.

(6) Spreading yourself too thin

If you're trying to post on  all social media networks, stop. Take a look at where your audiences are - are they on Twitter, Pinterest, Facebook and Google+? If you are chasing after possible leads, it's best to focus on a few social media networks where they congregate. Rather than signing up for almost every social network, it's better to focus on a few where you can get the most targeted leads.

(7) Missing in action

If you are or if you have an erratic social media manager, it's difficult to gain results from inconsistent updates. Promoting your business and pushing your brand forward requires a  constant stream of updates to let your followers know that you're there and always available.

(8) You're unprofessional and careless

Typographical errors, grammar mistakes, and being too informal in creating updates puts your brand at risk. You'll be seen as unprofessional and people who follow you might think that you're not serious about your business. Social media marketing may not require everyone to be too formal, but you can be neutral, friendly, and accommodating, while maintaining a professional approach.

(9) Faking it

Being authentic, honest, and transparent can help win more followers and potential clients because you are not hiding behind a façade. You can provide opinions and facts to influence people with your genuineness. Always say what you mean and mean what you say. because it's your brand you're putting out there.

(10) You're too self-centered

It's not always about you. Always provide information that will help your followers, even if it’s not your content. . Be sure to share links to resources that your audience  can benefit from and also make sure to mention and thank the rightful owners.

(11) Why so serious?

Add a sense of humor when needed. You can add a bit of fun in your updates and promotions to lighten up the mood and engage  your followers. When an occasion calls for it, see to it that your updates are appropriate and light-hearted, without deviating from your content.

(12) You're being too safe

Don't be bland in engaging with your followers. You can be bold and expressive without offending.. Show personality in your updates and engagements, but do avoid arguments and being controversial. Keep it professional, honest, and creative with your responses.

(13) Where are the photos?

Adding photos or any shareable imagery, especially for social media updates, is the norm. Visual content attracts more attention than bland and wordy messaging. Use stock images, candid photos, Instagram, vine, and video to match your updates.

(14) Not checking the numbers

Defining your goals and developing a method for measuring your social media will help you see the results of your efforts. It's not enough that you're promoting your brand to followers if you cannot see any result.

(15) Not setting a budget

While organic search still lives, it's not always a reliable source of new leads. If you want to get your brand out there and be seen, it's best to spend a little for social media - either for tools, apps, or services.

Check your own strategies and see what needs to changed. There's always a chance you're making a few of these social media mistakes and now is the time to correct them.

If you need help and guidance in your social media marketing techniques, call us now. We can help you improve it for better results.

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, July 20, 2015 10:24:00 PM Categories: B2B B2C marketing tips online marketing small business tips SMB social media social media marketing

Website Tips and Trends: Top 5 Website Layout Trends in 2015 

Want to get ahead of your website conversions but don't know which one works best for your niche? Here's 5 trendy layouts for you.

Website layout trends

The ever evolving web has seen many changes in the way websites are developed and designed. From the glitzy and glamorous, to the simplistic and minimalist, today's website layouts are geared toward the user experience rather than impressing them.

If you are looking for website layout trends in 2015, here's a mix of remarkable and inspiring layouts you may want to apply:

Single Screen

Filling a single screen is one of the trends today. It is also a type of responsive design that adapts to the screen size, but has no scroll bars. The design completely fills the screen. The content of the site is tremendously focused and the (content) hierarchy is visibly established.

Single screen website can sometimes be dominated by a responsive image or a video clip.

Check out some examples of single screen website layouts here.

Grid-based

Modular or grid-based layout is also a responsive type of design. It’s flexible to adapt the size of the screen and uses adaptable layouts using plug-ins.

Creating same-size modules is one of the challenges of this layout since it lessens the emphasis on the most interesting content on the site. It is also difficult to grab the viewer's attention if you're focused on promoting a particular material or content on the site. Creating grids with various dimensions can prevent such problems.

Open style

We are all familiar with the design elements such as shapes, lines, boxes, and other 'dividers' containing content. Two of the most prominent elements among them are headers and footers which are designed to separate the important content from the rest of the material.

The latest website layout trend to remove of these elements and design a more open and free style layout. It offers a minimalistic look and feel, with an emphasis on the main content..


Split Screen

Split screen layout allows emphasis on two principal elements on a website. The significance of any website element is usually reflected on the hierarchy and structure. In this case, if you focus on two elements and would like to promote them simultaneously, a split screen website could be the best option.

Conveying duality is another reason to use this layout. If your business puts emphasis on products/services and your team, then this is the best layout to showcase your core assets to potential customers.

Flat UI

Another emerging trend is the use of flat user interface. This website layout strongly focuses on content and provides basic pattern with minimal distracting elements. Level UI is more simplistic in technique and has fewer image-concentrated patterns. There are easier pattern elements and fewer photographs which give way to a much faster website.


These are just some of the trends that many websites have applied and implemented these days. However, these are also building blocks which can be used in a variety of ways. Design according to any of these website layout trends depends on your business goals and how you can provide the best experience to your customers.

The usability and functionality of these layouts are also ever-evolving - allowing web designers to work on challenging but worthwhile mediums for every website owner's objectives.

If you wish to know more about these web layout trends or you would like to implement one for your business website, contact us today.

View User Profile for
Posted by Monday, July 13, 2015 9:56:00 AM Categories: B2B B2C responsive design SMB web design web trends website
Page 1 of 24 1 2 3 4 5 6 7 8 9 10 > >>