Change Tick Frequency in Matplotlib

Introduction Matplotlib is one of the most widely used data visualization libraries in Python. Much of Matplotlib’s popularity comes from its customization options – you can tweak just about any element from its hierarchy of objects. In this tutorial, we’ll take a look at how to change the tick frequency in Matplotlib. We’ll do this on the figure-level as well as the axis-level. How to Change Tick Frequency in Matplotlib? Let’s start off with a simple plot. We’ll plot two […]

Read more

How to Sort a Dictionary by Value in Python

Introduction A dictionary in Python is a collection of items that stores data as key-value pairs. In Python 3.7 and later versions, dictionaries are sorted by the order of item insertion. In earlier versions, they were unordered. Let’s have a look at how we can sort a dictionary on basis of the values they contain. Sort Dictionary Using a for Loop We can sort a dictionary with the help of a for loop. First, we use the sorted() function to […]

Read more

Introduction to StanfordNLP: An Incredible State-of-the-Art NLP Library for 53 Languages (with Python code)

Introduction A common challenge I came across while learning Natural Language Processing (NLP) – can we build models for non-English languages? The answer has been no for quite a long time. Each language has its own grammatical patterns and linguistic nuances. And there just aren’t many datasets available in other languages. That’s where Stanford’s latest NLP library steps in – StanfordNLP. I could barely contain my excitement when I read the news last week. The authors claimed StanfordNLP could support more […]

Read more

Building a Recommendation System using Word2vec: A Unique Tutorial with Case Study in Python

Overview Recommendation engines are ubiquitous nowadays and data scientists are expected to know how to build one Word2vec is an ultra-popular word embeddings used for performing a variety of NLP tasks We will use word2vec to build our own recommendation system. Curious how NLP and recommendation engines combine? Let’s find out!   Introduction Be honest – how many times have you used the ‘Recommended for you’ section on Amazon? Ever since I found out a few years back that machine […]

Read more

A Must-Read NLP Tutorial on Neural Machine Translation – The Technique Powering Google Translate

Introduction “If you talk to a man in a language he understands, that goes to his head. If you talk to him in his own language, that goes to his heart.” – Nelson Mandela The beauty of language transcends boundaries and cultures. Learning a language other than our mother tongue is a huge advantage. But the path to bilingualism, or multilingualism, can often be a long, never-ending one. There are so many little nuances that we get lost in the […]

Read more

OpenAI’s GPT-2: A Simple Guide to Build the World’s Most Advanced Text Generator in Python

Overview Learn how to build your own text generator in Python using OpenAI’s GPT-2 framework GPT-2 is a state-of-the-art NLP framework – a truly incredible breakthrough We will learn how it works and then implements our own text generator using GPT-2   Introduction “The world’s best economies are directly linked to a culture of encouragement and positive feedback.” Can you guess who said that? It wasn’t a President or Prime Minister. It certainly wasn’t a leading economist like Raghuram Rajan. […]

Read more

6 Exciting Open Source Data Science Projects you Should Start Working on Today

Overview Here are six open-source data science projects to enhance your skillset These projects cover a diverse set of domains, from computer vision to natural language processing (NLP), among others Pick your favorite open-source data science project(s) and get coding!   Introduction I recently helped out in a round of interviews for an open data scientist position. As you can imagine, there were candidates from all kinds of backgrounds – software engineering, learning and development, finance, marketing, etc. What stood […]

Read more

What Does if __name__ == “__main__”: Do in Python?

Introduction It’s common to see if __name__ == “__main__” in Python scripts we find online, or one of the many we write ourselves. Why do we use that if-statement when running our Python programs? In this article, we explain the mechanics behind its usage, the advantages, and where it can be used. The __name__ Attribute and the __main__ Scope The __name__ attribute comes by default as one of the names in the current local scope. The Python interpreter automatically adds […]

Read more

Seaborn Scatter Plot – Tutorial and Examples

Introduction Seaborn is one of the most widely used data visualization libraries in Python, as an extension to Matplotlib. It offers a simple, intuitive, yet highly customizable API for data visualization. In this tutorial, we’ll take a look at how to plot a scatter plot in Seaborn. We’ll cover simple scatter plots, multiple scatter plots with FacetGrid as well as 3D scatter plots. Import Data We’ll use the World Happiness dataset, and compare the Happiness Score against varying features to […]

Read more

How to Set Axis Range (xlim, ylim) in Matplotlib

Introduction Matplotlib is one of the most widely used data visualization libraries in Python. Much of Matplotlib’s popularity comes from its customization options – you can tweak just about any element from its hierarchy of objects. In this tutorial, we’ll take a look at how to set the axis range (xlim, ylim) in Matplotlib, to truncate or expand the view to specific limits. Creating a Plot Let’s first create a simple plot: import matplotlib.pyplot as plt import numpy as np […]

Read more
1 13 14 15 16 17 54