AI, startup hacks, and engineering miracles from your friends at Faraday

Set application_name in ActiveRecord connections

Seamus Abshere on

Here's a great way to make Rails apps running on Postgres more inspectable.

Just put this in config/initializers/application_name.rb:

ActiveRecord::Base.connection.class.set_callback(:checkout, :after) { raw_connection.exec "set application_name = 'MyRailsApp'" }  

Now when you inspect pg_stat_activity, you can tell which app is which.

psql# select  
    regexp_replace(query, '\s+', ' ', 'g') AS "query"
  from pg_stat_activity where not query ~ 'pg_stat_ac' ;
 application_name | state | pid |                                                                                                                                                               query
                  | -     |  24 |
                  | -     |  22 |
 MyRailApp        | idle  | 111 |  SELECT a.attname, forma[...]
                  | -     |  20 |
                  | -     |  19 |
                  | -     |  21 |
(6 rows)

Thanks to this question on SO!

Where do you stand in the current AI landscape?

Perry McDermott on

Artificial intelligence technologies

You've probably noticed the growing buzz around AI and ML. You've likely done some research into the field, read some AI success stories, and believe that artificial intelligence is more than just a buzzword.

Sound like you? Good, you're totally on the right path!

So is all the hype true? Is AI really as promising as it seems? Have most companies already adopted AI? Or even worse, are you too far behind to be competitive with AI?

Luckily, you're not too late.

Hype versus reality

In a survey of over 3,000 senior executives, McKinsey found that only 10% of respondents said they have actually operationalized AI at scale.

That said, another 10% claimed to have operationalized AI in at least one core business function, and about 40% are experimenting with some form of AI.

Couple those numbers with the massive increase in AI-related investments over the last few years, and we can see the time to get serious about AI is undoubtedly now.

Where's the interest, and how much is there?

Over the last five years, investments in AI have more than tripled. In 2016 alone, total investments (internal and external) ranged from $26 billion to $39 billion, with over 75% of that coming from tech giants like Amazon, Apple, Google and Baidu.

These cash-rich giants have mostly invested internally — on R&D and deployment — but they've also invested significantly in hard-to-find talent, primarily through major acquisitions.

Source: MGI Artificial Intelligence Discussion paper.

How can I possibly catch up and get ahead?

These massive investments can feel deflating, and rightly so if your plan is to go head-to-head with the giants by building up your own AI tools in-house. The good news is that you don't have to, and often shouldn't develop AI from scratch.

A wealth of AI startups have caught some serious traction by developing fit-for-purpose solutions that address focused sets of business challenges.

Whether those challenges rest in IT and security, finance and accounting, or revenue growth and marketing, organizations can easily adopt and operationalize these "off-the-shelf" solutions in a fraction of the time, and at a fraction of the cost of alternative "one-size-fits-all" solutions like IBM's Watson.

The key is to automate tasks that have an immediate impact on your top and bottom lines. AI technologies can't replace your entire marketing team, but they can arm that team with powerful customer insights and predictions, simply unattainable without powerful machine learning algorithms.

Some use cases

For more on this, and to read some specific use cases for off-the-shelf AI solutions, download our free whitepaper, AI or die: Understanding the inevitability of AI in business.

AI or die: Understanding the inevitability of AI in business

Optimize your marketing outreach with AI-powered audience expansion

Perry McDermott on

Customer Lifecycle Marketing Audience

This post is part 4 of our 4-part Customer Lifecycle Optimization series.

First, identify your most predictive customer lifecycle data

B2C revenues are often tied directly to customer lifecycle outcomes. Targeting likely-to-convert leads, identifying good up-sell candidates amongst your existing customers, and proactively engaging churn-prone customers are all good ways to boost revenues while reducing overall customer acquisition costs.

The key to identifying those likely-to-convert leads, up-sell candidates, and churn-prone customers is mapping out your customer lifecycle and identifying predictive lifecycle data to better predict future behavior. With data-driven predictions, you can optimize your outreach initiatives by targeting better audiences at each stage of the customer lifecycle.

Motivating transitions between customer lifecycle stages

Whether you want to increase conversion rates from lead generation campaigns or reduce churn from existing customers, properly targeted outreach is essential to engaging and motivating the right leads and customers to take a desired action.

Outbound communication is the strongest and most versatile intervention at an organization's disposal to compel progress and therefore expand revenue. This includes individually targeted digital advertising, a form of direct outreach.

Consider the following examples of outreach initiatives:

Example Marketing Outreach Intervention

Having identified a stage transition you'd like to motivate with an outreach intervention, the question becomes, "Who do I reach?" Regardless of the desired transition, the general technique is called audience expansion, also known as "lookalike" audiences.

3 examples of audience expansion

The following table contains three examples of audience expansion. In each case, an existing audience is "expanded" by identifying individuals with similar attributes in a larger set of candidates.

3 Examples of Audience Expansion

Note that in the third example, retention, we're looking for candidates (current customers) likely to join the indicated audience (lost customers) thereby entering the destination stage (reactivation) so that we can act to prevent that transition.

Audience vs candidates

To apply the audience expansion technique, we must always identify the audience and a set of candidates with similar characteristics and attributes.

An audience is a sample of the customers you're trying to find more of. This can be as simple as matching a lifecycle stage (i.e. retention and expansion), or as specific as trying to find more high-value customers.

Candidates consist of the universe of possible recipients of your outreach within which to expand your audience. Using lead generation as an example, your candidates would be your current leads, while the corresponding audience would be your current customers. Your audience (customers) is expanding into these candidates (leads) with motivation from your outreach initiatives.

Applying your predictive groundwork

With these groups defined, the next step is to apply your predictive groundwork. This could involve using patterns you identified in your data to look for similar opportunities among your candidates, or in more advanced cases, using artificial intelligence to build a predictive model trained to discriminate between likely and unlikely transitioners.

Finally, you will be left with a well-defined group of candidates likely to transition into a desired lifecycle stage when reached with relevant content.

Putting it all together

As mentioned earlier, this article is the fourth and final part of our customer lifecycle optimization series. To summarize the CLO practice, it's useful to recall our original motivation.

We employ AI-powered predictions to build and defend revenue by improving outcomes within our customer lifecycle. We know this means motivating transitions from one stage to the next.

    4) Leverage these patterns to guide outreach.

For more information on anything discussed in our customer lifecycle optimization blog series, download our free whitepaper: AI for the customer lifecycle: Making the most of your data.

Faraday Whitepaper|Customer Lifecycle Optimization