Data Science Data Science, Product | May 25, 2016

What Are The Best Tools for Data Analysis?

Are you using the best tools for data analysis?

When you’re new to data science, you might find difficulty in choosing the right language for data analysis. To know how to use the best tools in analysis, the key lies in learning the difference and understanding the best use cases.

For many reasons, R and Python are two of the most popular languages. While R is often admired for its great features for data visualisation, most programmers love multi-purpose Python for its simple syntax.

Manish Khandelwal
Manish Khandelwal: Senior Data Scientist @Media iQ

To understand the difference between the two, and also to know about a new entrant – Spark, Manish Khandelwal, Senior Data Scientist at Media iQ gives us more details.

 

Understanding the Difference between the Three

“R and Python are widely used in the industry for data science related tasks including data analysis, data processing and machine learning. Spark is a new entrant in this area with distributed computing capabilities”, says Manish.

But before comparing Spark, R & Python, let us first explore R and Python separately. There have been many debates around R vs Python already. Both have their pros and cons and using one of them is sometimes left to the developer or the analyst’s wish.

Key differences between R & Python:

  • Statisticians and data analysts use R for data analysis, while developers prefer Python for data related tasks. If we look at the user base, Python has a larger user base because it can be used for scripting, web development etc., when compared to R. But when it comes to data analysis specific users, R has a bigger user base.
  • While R has been around for a longer time, with a rich set of libraries, Python is comparatively newer, with functionalities for data analysis and data science getting added on until recently. R has different packages for most of the tasks which can be downloaded from the CRAN (Comprehensive R Archive Network) repository, Python users on the other hand, can use NumPy, Scipy, Pandas and Scikit-learn for similar tasks. Installing R packages is easy to do (single line command), while it is time-consuming to install python packages before using them.
  • Python has an advantage over R of being quicker, as R was designed to make analysis easier. R, on the other hand has better visualization options when compared to Python.
  • RStudio has a good IDE (integrated development environment) and is mostly used by those who use R. However, there is no single IDE which is used by all Python users. Users can either use spyder, Rodeo, IPython notebook or any other available IDE according to their convenience.
  • For text processing, Python is a better choice as Python plays well with Strings, and while R has openNLP for text, Python has NLTK (Natural Language Toolkit).

However, the usage of R or Python depends on use-cases and on the environment.

Knowing More about Spark

When it comes to big data, R or Python might not perform well as they may not be able to break computations in a way which can run parallel on a system’s core. This is where Spark is more effective. Spark is a distributed computing system that tries to break such computations, runs processes in parallel and makes the best use of available resources. Also, unlike R or Python that require high configuration machines to process large amounts of data, Spark runs on a cluster of few low configuration machines. Even the cost of a machine does not increase linearly with configuration. Therefore, Spark not only provides better performance, but is more cost-effective when compared to R or Python.

When it comes to using MapReduce with R or Python, users would need to install such packages and write the code accordingly, but in Spark this can be done easily as it provides users with a native library for machine learning (Mlib) and in-built MapReduce functions. Therefore, even from a usability perspective, Spark wins over both.

But would users need to learn a new language to use Spark? Will it take more time and hence delay the product delivery? The answer is No! Spark gives users the option to either code in Java, Scala or Python. And if data scientists are familiar with python, it becomes easier for them to start using Spark. When it comes to R, SparkR is already in production with some basic functionalities, enabling users to use Spark by using either Java, Scala, Python or R.

So is Spark a Preference over R/Python in all cases?

The answer is No. If your data is small enough to be processed by single node R or Python, then running Spark may take extra time because of its distribution overhead. Also, since Spark is a recent entrant, there have been only standard algorithms implemented till now. For complicated or advanced algorithms, users still need to use R or Python.

We at Media iQ, use both R and Python for data related tasks. Spark is being used in some of our products. For example, for Predict– which allows brands to forecast prospective users who may convert, and targets them in real-time, we are training our models on around 10 million data points with each data point having features in the range of 500~10K. Spark is therefore, used to train and predict on such volumes of data, which may not be possible to do with R or Python.

The Choice is To Use All Three…

While the battle for the “best” data science tools continues, Python, R and Spark, all have their pros and cons. Selecting one over the other will depend on the use-cases, the cost of learning, and other common tools required. Using more tools will only make users better data scientists, enabling better analysis of volumes of data.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *