Using Decorators in Python

In Python, decorators allow Data Scientists to extend and modify callables, such as functions, methods and classes, without explicitly changing the callable. Using decorators can improve the readability of your code as well code flexibility and modularity. In this article, we’ll discuss why we would use decorators, how to implement decorators and give a few examples. Use Cases for Decorators in Python Decorators are powerful because they enable “wrapping” of functions with a master function. Some common use cases for decorators in Python include: ...

February 20, 2021 · 6 min

Binder & Repl.it

I recently discovered two great tools for easily creating interactive coding environments without installing a thing. These tools facilitate sharing of code in multiple languages and are wonderful resources for demonstrating programming concepts when teaching a course. Binder The first tool is called Binder, is open-source and was released in 2017. It is awesome because it allows data scientists to share their work in Python , R or Julia in a reproducible manner. Binder can be configured for Python (Anaconda or pip environment) and R (using RStudio and/or Shiny). Multiple user interfaces can be specified. For example, for Python we can use a terminal or Jupyter notebook in the repo. ...

February 15, 2021 · 4 min

Creating Projects from Cookiecutter Templates

Ever want to generate a new repo based on a predefined template? Now you can using Cookiecutter! I will show you how to easily spin up a fresh Cookiecutter repo for your latest data science project in Python. Cookiecutter is an awesome command-line tool and Python package that creates projects (aka populates repo folders) based on cookiecutters (or project templates). What does this mean? Goodbye to manually copying and pasting old project repos. Now, you can automatically clone one of the thousands of cookiecutters or you can create your own. ...

January 25, 2021 · 3 min

Best 2021 Resources for Learning about AI/ML

For upskilling on AI/ML, I prefer taking a top-down approach i.e. starting with high level concepts then proceeding to more foundational topics (read: delve more into the theory) . I liked taking the breadth-first approach (rather than a depth-first approach) to initially understand AI/ML. Once I had a solid foundation, I easily pivoted to learning a specific topic, like masked regional CNNs, for building expertise through real-world experience. I took multiple courses and read several authors at the same time. You want to find the right sources of information for you and there are so many options out there, so explore. Sometimes I need to read or watch something a few times from different folks before it just clicks. This ultimately accelerated my learning of concepts. Completion of courses should not be the ultimate goal as some courses cover trivial topics and others go too deep into other topics. ...

January 20, 2021 · 6 min

PyCon 2020

Hey Folks! I finally got around to watching a bunch of the talks and found several of the talks useful for improving my Python coding skills in general and/or in the context of doing Data Science. Here are some interesting talks from PyCon 2020: Beautiful Python Refactoring video. The talk was simple but powerful in demonstrating the process of refactoring in Python. Docker and Python: making them play nicely and securely for Data Science and ML. Talk discussed why use Docker in general and for machine learning, and how to manage security and performance while using Docker. It’s a great introduction to Docker - motivating its use case as a Data Scientist. Some tips that she shared include getting standard project templates from cookie cutter data science. Another was to use repo2docker to build a docker based on a local or remote repo. It was also very engaging. Small Big Data: Using Numpy and Pandas When Your Data Doesn’t Fit In Memory. This talk expanded my knowledge of Numpy and Pandas for handling small big data, which happens more than you think. Pro-tip: Watch at ~1.5 speed to save time!

January 14, 2021 · 1 min

Writing Awesome READMEs

This article will explore possible items to include your Git repo README file. We will discuss several items that we can include in a README and when to include them. What is a README? A README file is a text file that explains a project to new user. It helps users quickly understand where to find information on the project such as brief description of your project, how to install/fork it and/or how to use your code. READMEs live in the top level directory of your repo in GitHub, Bitbucket or GitLab. ...

January 13, 2021 · 2 min

Using Classes in Python

We know that you’ve probably heard of object oriented programming (OOP), but outside of designing games, when is best to use it for data science? We haven’t used OOP much until recently when we refactored a data science project code base. In this article, we give a brief refresher for OOP and discuss our top reasons for using OOP with a few examples. When we code, we generally skew towards more of a functional style of programming, but sometimes we get frustrated with code that is too long. This means that we focus on building our code using functional modules of code and functions. However, at some point, our functions become too large to keep track of and we consider refactoring into classes. ...

December 8, 2020 · 4 min

Staying Up-To-Date on AI/ML

Great Email Newsletters on AI/ML All newsletters are released weekly. Import AI - AI newsletter that summarizes recent news articles and research; I enjoy how honest and succinct this newsletter is; also like that the implications of new algorithms are always discussed by Jack, who is an advocate for improved ML model explicability and data privacy. AI News Weekly - curated list of AI-related articles; presents a brief summary of each article describing the latest news, applied use cases and ethics; has ads AI Applied use Cases Top News - curated list of the latest AI news articles; subscribers can customize their newsletters according to topics of interest; weekly The Batch - newsletter from deeplearning.ai more academic with discussion of recent AI research papers; great breakdown of topics e.g. what’s new, why it matters and the implications TOPBOTS - list of various AI articles recently released on TOPBOT.com; articles cover a wide array of topics e.g. NLP, ML in marketing and interpretability; articles tend to be more technical PyImageSearch - articles on using Python to tackle real-world computer vision and deep learning problems; very practical, well-done computer vision blog. I highly recommend Adrian’s free email courses. ODSC - newsletter with articles spanning various topics geared to beginners, experts and everyone in between. They also offer webinars (free and paid) as well as online meetups. Podcasts Data Skeptic has short episodes that cover various ML concepts TWIML AI - Formally This Week in ML & AI is hosted by Sam Charrington who asks really strong questions to the latest and greatest AI/ML researchers. Practical AI - aims to make AI accessible to everyone Find Practical Information on AI/ML ...

November 24, 2020 · 5 min

R vs Python

I generally reach for Python when building data science pipelines, however I discovered R before I decided to invest in learning Python. R has saved me lots of time when it came to quickly and easily preparing nice-looking plots for research. It begs the question of where is R better than Python for certain purposes? We will discuss the benefits and downsides of Python and R so that we can reach for the appropriate tool when needed, instead of treating all problems like nails when a screwdriver is required. ...

October 26, 2020 · 3 min

Export Images to PowerPoint in Python

Data Scientists spend a significant amount of time visualizing data for storytelling or conveying insights to end users of a data product. Often, the ability to succinctly and accurately explain the methods used and insights derived hinges on the medium of communication and time taken to prepare visualizations. In order to limit time spent on manually building reports or PowerPoint slides, one page at a time, we could automate the process. Let’s automatically create a slide deck containing plots created in Python. It’s not too hard, but there are a few tips that definitely make the process easier. We will use the python-pptx library read in template PowerPoint files and create new slides with exciting content. Python-pptx has the capability to add text, SmartArt, and other media formats to slides based on a template file. ...

October 26, 2020 · 6 min