How to perform Text Mining at the Speed of Thought directly in Tableau

Interactive real-time text mining with Tableau 9.2
Interactive real-time text mining with Tableau 9.2

When I was doing text mining, I was often tempted to reach out for a scripting language like R, Python, or Ruby – and then I feed the results into Tableau. Tableau served as a communications tool to represent the insights in a pleasant way.

Wouldn’t it be handy to perform text mining and further analysis at the speed of thought directly in Tableau?

Tableau has some relatively basic text processing functions that can be used for calculated fields. This is, however, not enough to perform text mining such as sentiment analysis, where it is required to split up text in tokens. Also Tableau’s beloved R integration will not help in this case.

As a workaround, I decided to use Postgres’ built-in string functions for such text mining tasks, which perform much faster than most scripting languages. For the following word count example, I applied the function regexp_split_to_table that takes a piece of text (such as a blog post), splits it by a pattern, and returns the tokens as rows:


select
guid
, regexp_split_to_table(lower(post_content), '\s+') as word
, count(1) as word_count
from
alexblog_posts
group by
guid, word

I joined this code snippet as a Custom SQL Query to my Tableau data source, which is connected to the database that is powering my blog:

Screenshot 2016-01-14 15.34.46

And here we go, an interactive word count visualization:

 

This example could be easily enhanced with data from Google Analytics, or altered to analyse user comments, survey results, or social media feeds. Do you have some more fancy ideas for real-time text mining with Tableau? Leave me a comment!

: How to identify Twitter hashtags? Do I need another RegEx?

Another regular expression via a Custom SQL Query is not required for identifying words within tweets as hashtags. A simple calculated field in Tableau will do the job:


CASE LEFT([Word], 1)
WHEN "#" THEN "Hash Tag"
WHEN "@" THEN "User Reference"
ELSE "Regular Content"
END

Looking for an example? Feel free to check out the Tweets featuring #tableau Dashboard on Tableau Public and download the Packaged Workbook (twbx):

Tweets featuring #tableau Dashboard

Any more feedback, ideas, or questions?

KPMG Global Automotive Executive Survey 2016

KPMG Global Automotive Executive Survey 2016: click to open interactive story
KPMG Global Automotive Executive Survey 2016: click to open interactive story

In the recent months, 800 automotive executives from 38 countries gave their insights to KPMG. You can discover the key highlights of the KPMG Global Automotive Executive Survey in this eye-catching interactive Tableau story.

This is a fabulous example how you can use stories to present a narrative to an audience. Just as dashboards provide spatial arrangements of analysis that work together, stories present sequential arrangements of analysis that create a narrative flow for your audience.

5 Vorteile von Data Science

Deutschherrnbrücke mit Skyline von Frankfurt am Main
Nicht nur Banken handeln ihre Daten als Gold des 21. Jahrhunderts

Keine Frage, die Digitalisierung prägt unseren Alltag und stellt auch an Banken immer neue Anforderungen. Daten werden als das neue Gold gehandelt. Und genau darin liegt die große Chance der Banken: Finanzinstitute hatten schon immer enorme Mengen an Daten, oft aus vielen verschiedenen Quellen. Aber wie wird das volle Potenzial dieser Daten genutzt und wie werden Erkenntnisse aus diesen gewonnen? Hier kommt Data Science ins Spiel.

Wie gewinnen Sie Erkenntnisse aus Ihren Daten?

Data Science verwendet Methoden aus der Mathematik, Statistik und Informationstechnologie. Data Scientists verfügen darüber hinaus über ausgeprägte Kommunikationsfähigkeiten auf sämtlichen Ebenen eines Unternehmens und bereiten Ergebnisse für das Management der einzelnen Fachabteilungen genauso verständlich auf wie für den CEO. Banken können dazu neben Kontoinformationen auch Kundentransaktionen, Kundenkommunikation, Kanalnutzung, Kundenverhalten und Social-Media-Aktivitäten. Vieles davon wird idealerweise nahezu in Echtzeit verarbeitet und ausgewertet.

Der Daten-Leverage-Effekt:

Da der Bankensektor weiterhin mit knappen Margen und und schwindendem Gewinn zu kämpfen hat, ist es für Finanzinstitute äußerst wichtig einen Hebel anzulegen, um Kosten zu reduzieren, Kunden zu binden und neue Einnahmequellen zu erschließen. Einen solchen Daten-Leverage-Effekt erzielen Sie mit ihren Daten – sofern Sie auf Data Science und damit einhergehend auf eine erweiterte Analyse setzen.

Betrachten Sie diese fünf Vorteile:

  1. Bessere Erkenntnisse: Gewinnen Sie eine neue Sicht auf Ihre treuesten und profitabelsten Kunden und verstehen Sie deren Bedürfnisse bereits vor dem Kundengespräch. Datenanalyse kann helfen, den Überblick zu behalten und Vorschläge für entsprechende Kommunikationskanäle zu liefern.

  2. Kundenbindung: Sorgen Sie für zufriedenere Kunden und finden Wege treue Kunden zu belohnen. Zudem lassen sich Kunden identifizieren, die ggf. eine Kündigung erwägen. Führen Sie dazu die Metriken “Loyalität” und “Churn” ein, um hierfür ein Messinstrument zu haben.

  3. Kostengünstiges Marketing: Entwickeln Sie effektives Marketing und Kampagnen, die an die richtige Person zur richtigen Zeit ausgerichtet sind. Dabei hilft Ihnen eine Cluster-Analyse, um Kundensegmente zu identifizieren.

  4. Minimieren von Risiken: Beschleunigen und verbessern Sie Ihr Risiko- und Fraud-Management durch Mustererkennung und Maschinenlernen.

  5. Handeln Sie: Behalten Sie Ihr Dashboard mit den wesentlichen Kennzahlen im Auge und ergreifen Maßnahmen, deren Auswirkung Sie zeitnah beobachten können. Nutzen Sie die Daten und Vorhersagen als Kernelement für Ihre Storyboards mit denen Sie das Top-Management überzeugen.

Nutzen Sie bereits die richtigen Werkzeugen zur Datenanalyse und Datenvisualisierung in Ihrem Unternehmen? Falls nicht, wäre es nun an der Zeit über den Einsatz von Data Science nachzudenken.

Beitrag zuerst veröffentlicht am 19.06.2015 im Capgemini IT-Trends-Blog.

IMF Global Data Explorer

How about some visual takeaways from the IMF’s World Economic Outlook? Recently I prepared two nifty data visualizations with Tableau that I like to share with you.

These visualizations allow you to explore plenty of economical data, including IMF staff estimates until 2020. Don’t forget to choose “Units” after switching “Subject” on the right-side bar. A detailed description on each subject is displayed below.

Tableau

Data Science Toolbox: How to use R with Tableau

Recently Tableau released an exciting new feature: R integration via RServe. Tableau with R seems to bring my data science toolbox to the next level! In this tutorial, I’m going to walk you through the installation and connecting Tableau with RServe. I will also give you an example of calling an R function with a parameter from Tableau to visualize the results in Tableau.

1. Install and start R and RServe

You can download base R from r-project.org. Next, invoke R from the terminal to install and run the RServe package:

> install.packages("Rserve")
> library(Rserve)
> Rserve()

To ensure RServe is running, you can try Telnet to connect to it:

Telnet

Protip: If you prefer an IDE for R, I can highly recommend you to install RStudio.

2. Connecting Tableau to RServe

Now let’s open Tableau and set up the connection:

Tableau 10 Help menu

Tableau 10 External Service Connection

3. Adding R code to a Calculated Field

You can invoke R scripts in Tableau’s Calculated Fields, such as k-means clustering controlled by an interactive parameter slider:


SCRIPT_INT('
kmeans(data.frame(.arg1,.arg2,.arg3),' + STR([Cluster Amount]) + ')$cluster;
',
SUM([Sales]), SUM([Profit]), SUM([Quantity]))

Calculated Field in Tableau 10

4. Use Calculated Field in Tableau

You can now use your R calculation as an alternate Calculated Field in your Tableau worksheet:

Tableau 10 showing k-means clustering

Feel free to download the Tableau Packaged Workbook (twbx) here.

Update 26 Jun 2016: Tableau 8.1 screenshots were updated with Tableau 10.0 (preview) screenshots due to my upcoming Advanced Analytics session at TC16, which is going to reference back to this blog post.