Newsletter: Data & AI Digest #2

Generated with DALL-E
Generated with DALL-E

👋 Hello Data & AI Enthusiasts,

Welcome to another edition of the Data & AI Digest! We’re excited to bring you a curated selection of the week’s most compelling stories in the realm of data science, artificial intelligence, and more. Whether you’re a seasoned expert or a curious beginner, there’s something here for everyone.

  1. [AI] Understanding AI Performance: Discover how modern AI models often match or exceed human capabilities in tests, yet struggle in real-world applications. Read more
  2. [AI] Generative AI Strategy for Tech Leaders: CIOs and CTOs need to integrate generative AI into their tech architecture effectively. Explore 5 key elements for successful implementation. Read more
  3. [Statistics] Mastering the Central Limit Theorem in R: Understand the Central Limit Theorem, a cornerstone in statistics, and learn how to simulate it using R in this step-by-step tutorial. Read more
  4. [Graph Theory] Comprehensive Introduction to Graph Theory: This quarter-long course covers everything from simple graphs to Eulerian circuits and spanning trees. Read more
  5. [SQL] SQL Konferenz Highlights on Microsoft Fabric: Get an in-depth look at Microsoft Fabric and its role as a Data Platform for the Era of AI. Read more
  6. [Microsoft] Forbes Insights on Microsoft’s Copilots: Learn six critical things every business owner should know about Microsoft Copilot. Read more
  7. [GitHub] How GitHub’s Copilot is Being Used: GitHub’s Copilot remains the most popular AI-based code completion service. Find out the latest usage trends. Read more
  8. [Apple] iPhone 15 Pro’s Spatial Videos: Teased at Apple’s latest keynote, learn about the new spatial video capabilities of the iPhone 15 Pro. Read more
  9. [Geopolitics] China’s AI Influence Campaign: Researchers from Microsoft and other organizations discuss Beijing’s rapid change in disinformation tactics through AI. Read more

That’s a wrap for this week’s Data & AI Digest! We hope you found these articles insightful and thought-provoking. If you enjoyed this issue, help us make it bigger and better by sharing it with colleagues and friends. 🚀

Don’t forget, for real-time updates and discussions, join our LinkedIn Data & AI User Group. We look forward to your active participation and valuable insights.

Get the Data & AI Digest newsletter delivered to your email weekly.

Until next week, happy reading and exploring!

Data Science Toolbox: How to use Julia with Tableau

Julia in Tableau: R allows Tableau to execute Julia code on the fly, enhancing your data analytics experience.
Julia in Tableau: R allows Tableau to execute Julia code on the fly, enhancing your data analytics experience.

Michael, a data scientist, who is working for a German railway and logistics company, recently told me during a FATUG Meetup that he loves Tableau’s R integration and Tableau’s Python integration. As he continued, he raised the question of using functions they have written in Julia. Julia, a high-level dynamic programming language for high-performance numerical analysis, is an integral part of the newly developed data strategy in Michael’s organization.

Tableau, however, does not come with native support for Julia. I didn’t want to keep Michael’s team down and was looking for an alternative way to integrate Julia with Tableau.

This solution is working flawlessly in a production environment for several months. In this tutorial, I’m going to walk you through the installation and connecting Tableau with R and Julia. I will also give you an example of calling a Julia statement from Tableau to calculate the sphere volume.

Step by Step: Integrating Julia in Tableau

1. Install Julia and add PATH variable

You can download Julia from julialang.org. Add Julia’s installation path to the PATH environment variable.

2. Install R, XRJulia, and RServe

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

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

XRJulia provides an interface from R to Julia. RServe is a TCP/IP server that allows Tableau to use facilities of R.

3. Load libraries and start RServe

After packages are successfully installed, we load them and run RServe:

> library(XRJulia)
> library(Rserve)
> Rserve()

Make sure to repeat this step every time you restart your R session.

4. Connecting Tableau to RServe

Now let’s open the Help menu in Tableau Desktop and choose Settings and Performance >Manage External Service connection to open the External Service Connection dialog box:

TC17 External Service Connection

Enter a server name using a domain or an IP address and specify a port. Port 6311 is the default port used by Rserve. Take a look at my R tutorial to learn more about Tableau’s R integration.

5. Adding Julia code to a Calculated Field

You can invoke Calculated Field functions called SCRIPT_STR, SCRIPT_REAL, SCRIPT_BOOL, and SCRIPT_INT to embed your Julia code in Tableau, such as this simple snippet that calculates sphere volume:


SCRIPT_INT('
library(XRJulia)
if (!exists("ev")) ev <- RJulia()
y <- juliaEval("
4 / 3 * %s * ' + STR([Factor]) + ' * pi ^ 3
", .arg1)
',
[Radius])

6. Use Calculated Field in Tableau

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

Using Julia within calculations in Tableau (click to enlarge)
Using Julia calculations within Tableau (click to enlarge)

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

Further Reading: Mastering Julia

If you want to go beyond this tutorial and explore more about Julia in the context of data science, I recommend the book Mastering Julia. You can find it here.

Further Reading: Visual Analytics with Tableau

Join the data science conversation and follow me on Twitter and LinkedIn for more tips, tricks, and tutorials on Julia in Tableau and other data analytics topics. If you’re looking to master Tableau, don’t forget to preorder your copy of my upcoming book, Visual Analytics with Tableau. (Amazon). It offers an in-depth exploration of data visualization techniques and best practices.

Also, feel free to comment and share my Tableau Julia Tutorial tweet:

Tableau Conference TC17 Sneak Peek: Integrating Julia for Advanced Analytics

Demo: using Julia within calculations in Tableau (click to enlarge)
Demo: using Julia calculations within Tableau (click to enlarge)

We have already seen some love from Tableau for R and Python, boosting Tableau’s Advanced Analytics capabilities.

So what is the next big thing for our Data Science Rockstars? Julia!

Who is Julia?

JuliaJulia logo is a high-level dynamic programming language introduced in 2012. Designed to address the needs of high-performance numerical analysis its syntax is very similar to MATLAB. If you are used to MATLAB, you will be very quick to get on track with Julia.

Compared to R and Python, Julia is significantly faster (close to C and FORTRAN, see benchmark). Based on Tableau’s R integration, Julia is a fantastic addition to Tableau’s Advanced Analytics stack and to your data science toolbox.

Where can I learn more?

Do you want to learn more about Advanced Analytics and how to leverage Tableau with R, Python, and Julia? Meet me at the 2017 Tableau Conferences in London, Berlin, or Las Vegas and join my Advanced Analytics sessions:

Will there be an online tutorial?

Yes, of course! I published tutorials for R and Python on this blog. And I will also publish a Julia tutorial soon. Feel free to follow me on Twitter @xlth, and leave me your feedback/suggestions in the comment section below.

Further reading: Mastering Julia

A German translation of this post is published on the official Tableau blog: Tableau Conference On Tour Sneak Peek: Julia-Integration für Advanced Analytics

Update 11 Oct 2017: The Julia+Tableau tutorial blog post is now published.

Price and Sentiment Analysis: Why is Bitcoin Going Down?

Bitcoin Price and Sentiment Analysis with variable Moving Average: click to open interactive Tableau dashboard with annotations
Bitcoin Price and Sentiment Analysis with variable Moving Average: click to open interactive Tableau dashboard with annotations

Bitcoin has become one of the trendy investment assets in the recent years. Whenever bitcoin prices approach historical highs, every investor should watch the currency closely. Bitcoin rallied by more than 20% in the first days of 2017, crossing the $1000 mark for the first time since November 2013.

As many experienced bitcoin traders will remember, the first $1000 peak was a case of obvious over exuberance. Bitcoin was hot, plenty of money was pouring into it. Bitcoin investors got too excited, causing a price surge. Prices then rebounded and suffered a long-term collapse shortly after.

Moving Average Convergence/Divergence Indicator

Many traders rely on a Moving Average Convergence/Divergence (MACD) indicator. The MACD is a measure of the convergence and divergence between two EMAs (usually 12 and 26 days) and is calculated by subtracting the two of them. The signal line is constructed by creating an EMA (usually 10 days) of the signal line.

The signal line crossing the MACD from above is a buy signal. The signal line crossing the MACD from below is a sell signal. Relying only on momentum-based indicators (such as the MACD) and optimization-based models, however, will most certainly fail to indicate heavy price drops, as the drop in late 2016.

Predicting Fear with Sentiment Analysis

In late 2016 a lot of people began to pour money into bitcoin again. This time because they were worried that stock markets and other assets were due for a drop. For investors, it is essential to figure out whether or not these fears are actually founded. However, such „safe assets“ are prone to suffering from bubbles. People get scared, get invested into gold, or bitcoin, then realize that their fears were unfounded. As a result bitcoin prices could plummet.

So how to catch emotions such as fear in advance? Twitter is a valuable source of information and emotion. It certainly influences the stock market and can help to predict the market. Sentiment analysis can lead price movements by up to two days. Negative sentiment, however, is reflected in the market much more than positive sentiment. This is probably because most people tweet positive things about bitcoins most of the time. Even more positive news occurred after breaking the $1000 barrier.

This content is part of the session “Price and Sentiment Analysis: Why is Bitcoin Going Down?” that I deliver at the Frankfurt Bitcoin Colloquium. Have a look on my upcoming sessions!

[Update 14 Jun 2017]: Axis for Moving Average adjusted. Relative Date selector added with last 6 month as default. Screenshot updated.

Feel free to share the Bitcoin Price and Sentiment Analysis dashboard, which is also featured as Viz of the Day on Tableau Public:

TabPy Tutorial: How to Integrate Python with Tableau for Advanced Analytics

Python in Tableau: TabPy allows Tableau to execute Python code on the fly
Python in Tableau: TabPy allows Tableau to execute Python code on the fly

In 2013, Tableau introduced R Integration, the ability to call R scripts in calculated fields. This opened up possibilities such as K-means clustering, Random Forest models, and sentiment analysis. With the release of Tableau 10.2, we can enjoy a new, fancy addition to this feature: the Python Integration through TabPy, the Tableau Python Server.

Python in Tableau: The Perfect Blend

Python is a widely used general-purpose programming language, popular among academia and industry alike. It provides a wide variety of statistical and machine-learning techniques and is highly extensible. Together, Python and Tableau are the data science dream team to cover any organization’s data analysis needs.

In this tutorial, I’m going to walk you through the installation and connecting Tableau with TabPy. I will also give you an example of calling a Python function from Tableau to calculate correlation coefficients for a trellis chart.

Step by Step: Integrating Python in Tableau

1. Install and start Python and TabPy

Start by clicking on the Clone or download button in the upper right corner of the TabPy repository page, downloading the zip file, and extracting it.

TabPy download via GitHub web page

Protip: If you are familiar with Git, you can download TabPy directly from the repository:

> git clone git://github.com/tableau/TabPy

TabPy download via Git command line interface

Within the TabPy directory, execute setup.sh (or setup.bat if you are on Windows). This script downloads and installs Python, TabPy, and all necessary dependencies. After completion, TabPy is starting up and listens on port 9004.

2. Connecting Tableau to TabPy

In Tableau 10.2 (and later versions), a connection to TabPy can be added in Help > Settings and Performance > Manage External Service Connection:

Tableau main menu
Tableau main menu

Set port to 9004:

External Service Connection dialogue
External Service Connection dialogue

3. Adding Python code to a Calculated Field

You can invoke Calculated Field functions called SCRIPT_STR, SCRIPT_REAL, SCRIPT_BOOL, and SCRIPT_INT to embed your Python script in Tableau:

SCRIPT_REAL('
import numpy as np
return np.corrcoef(_arg1,_arg2)[0,1]
',
SUM([Sales]), SUM([Profit]))
Python script within Tableau
Python script within Tableau

4. Use Calculated Field in Tableau

Now you can use your Python calculation as Calculated Field in your Tableau worksheet:

Tableau workbook featuring a Python calculation
Tableau workbook featuring a Python calculation

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

Further Reading: Visual Analytics with Tableau

Join the data science conversation and follow me on Twitter and LinkedIn for more tips, tricks, and tutorials on Python in Tableau and other data analytics topics. If you’re looking to master Tableau, don’t forget to preorder your copy of my upcoming book, Visual Analytics with Tableau (Amazon). It offers an in-depth exploration of data visualization techniques and best practices.

Also, feel free to comment and share my TabPy Tutorial tweet:

Blog post updates: