Comments, Docstrings, and Type Hints in Python Code

The source code of a program should be readable to humans. Making it run correctly is only half of its purpose. Without a properly commenting code, it would be difficult for one, including the future you, to understand the rationale and intent behind the code. It would also make the code impossible to maintain. In Python, there are multiple ways to add descriptions to the code to make it more readable or make the intent more explicit. In the following, […]

Read more

Duck Typing, Scope, and Investigative Functions in Python

Python is a duck typing language. It means the data types of variables can change as long as the syntax is compatible. Python is also a dynamic programming language. Meaning we can change the program while it runs, including defining new functions and the scope of the name resolution. These give us not only a new paradigm in writing Python code but also a new set of tools for debugging. In the following, we will see what we can do […]

Read more

Easier Experimenting in Python

When we work on a machine learning project, we quite often need to experiment with multiple alternatives. Some features in Python allow us to try out different options without much effort. In this tutorial, we are going to see some tips to make our experiments faster. After finishing this tutorial, you will learn: How to leverage a duck-typing feature to easily swap functions and objects How making components into drop-in replacements for  each other can help experiments run faster Kick-start […]

Read more

Command Line Arguments for Your Python Script

Working on a machine learning project means we need to experiment. Having a way to configure your script easily will help you move faster. In Python, we have a way to adapt the code from a command line. In this tutorial, we are going to see how we can leverage the command line arguments to a Python script to help you work better in your machine learning project. After finishing this tutorial, you will learn Why we would like to […]

Read more

A Gentle Introduction to Serialization for Python

Serialization refers to the process of converting a data object (e.g., Python objects, Tensorflow models) into a format that allows us to store or transmit the data and then recreate the object when needed using the reverse process of deserialization. There are different formats for the serialization of data, such as JSON, XML, HDF5, and Python’s pickle, for different purposes. JSON, for instance, returns a human-readable string form, while Python’s pickle library can return a byte array. In this post, […]

Read more

Data Science Notebook Life-Hacks I Learned From Ploomber

Sponsored Post Me, a data scientist, and Jupyter notebooks. Well, our relationship started back then when I began to learn Python. Jupyter notebooks were my refuge when I wanted to make sure that my code works. Nowadays, I teach coding and do several data science projects and still, notebooks are the best tools for interactive coding and experimentation. Unfortunately, when trying to use notebooks in data science projects, things can get out of control quickly. As a result of experimentation, […]

Read more

A Gentle Introduction to Unit Testing in Python

Unit testing is a method for testing software that looks at the smallest testable pieces of code, called units, which are tested for correct operation. By doing unit testing, we can verify that each part of the code, including helper functions that may not be exposed to the user, works correctly and as intended. The idea is that we are independently checking each small piece of our program to ensure that it works. This contrasts with regression and integration testing, […]

Read more

Exploring the Python Ecosystem

Python is a neat programming language because its syntax is simple, clear, and concise. But Python would not be so successful without its rich third-party libraries. Python is so famous for data science and machine learning that it has become a de facto lingua franca just because we have so many libraries for those tasks. Without those libraries, Python is not too powerful. After finishing this tutorial, you will learn: Where the Python libraries are installed in your system What is […]

Read more

Data Visualization in Python with matplotlib, Seaborn, and Bokeh

Data visualization is an important aspect of all AI and machine learning applications. You can gain key insights into your data through different graphical representations. In this tutorial, we’ll talk about a few options for data visualization in Python. We’ll use the MNIST dataset and the Tensorflow library for number crunching and data manipulation. To illustrate various methods for creating different types of graphs, we’ll use Python’s graphing libraries, namely matplotlib, Seaborn, and Bokeh. After completing this tutorial, you will […]

Read more
1 43 44 45 46 47 907