The best ways to handle exceptions, write documentation, decorators for class inheritance and packages to automatically clean your code.

Building Python classes are always fun. But packaging them properly for efficiency, external use, and documentation is very important. In this article, I’ll cover five best practices to document, maintain, and test your Python classes. These methods include the best ways to handle exceptions, write documentation and doctests, decorators for class inheritance and data management, abstract classes and automated packages to clean and format your code.

Source: Unsplash

1 - Exception Handling

Building a Python class is cool. But it is also important to make sure that you’re raising the right errors when incorrect inputs are fed into your function. Here’s an example: Imagine that you’re…


In this article, I’ll help you build a simple API using Node.JS that works as an independent server and can handle multiple requests at once, thus adding to the scalability of your application and reliability of results.

For complex tasks that involve interacting with the system or its directories, Javascript itself becomes quite complicated. Hence, building every function into a Javascript frontend is hard. It is useful to build APIs that help a user perform various tasks. …


Are you tired of writing complicated code to do simple mathematical operations in Python? Most mathematical processes like integration, differentiation, or solving a system of equations require complicated coding (using lambda functions or SciPy functions) in Python. You can get used to it, but it’s not intuitive, and it’s confusing if you’re not an expert in Python. In this article, I’ll help you use SageMath to integrate your mathematical operations into Python easily.

Source: Unsplash

What is SageMath?

SageMath is an object-oriented language that is based in Python. So, you can write Python code in the same shell and also use simple SageMath functions to…


Source: Unsplash

In this article, I will demonstrate the use of Variational Inference to quantify the uncertainty in the weights of deep neural networks and make more informed predictions for a breast cancer classification dataset.

I’ll be building a probabilistic neural network in PyMC3 that uses ADVI to optimize the parameters of our model. We’ll be thinking more about the posterior distribution over the weights of the neural network and the insights that we can gain from it.

The goal

The goal here is to build an algorithm that can analyze information and metrics about one’s breast cancer cells to predict whether cancer in…


In this article, I will use the Mercari Price Suggestion Data from Kaggle to predict store prices using Automated Differentiation Variational Inference, implemented in PyMC3. This price modeling was done by Susan Li in this article where she uses PyStan. Some of my work has been inspired by her code.

I’ll explain more about the dataset, the transformations that I perform, the models I chose and the accuracy that I have obtained from it. Note that the aim of this article is to explore different techniques to better model the prices and think about some of the ways to better…


Understanding and interpreting the predictions for coronavirus infections and death tolls.

Source: UN News

In this article, I will try to help you navigate the pandemic of COVID-19 statistically and realistically amongst hundreds of estimates and models that are being produced around the world. I will explain a bit about the architecture of these models, their subjectivity, and the process of interpreting their estimates.

In the last two months, we all have seen multiple estimates and models of the growth of Coronavirus. Many of them, such as the most recent model predicting the death of 84,000 Americans by the end of the summer, is particularly concerning. Another model by Dr. Fauci at the National…


This article will help you understand the dynamics behind the execution of processes from the command line-terminal and ways to make it efficient. We’ll also explore the use of a terminal multiplexer called ‘tmux’ to run processes such as Jupyter Notebooks and Python/Bash scripts in your laptop or server background without any interruption.

If you use Jupyter Notebooks, you have probably seen the command line terminal (CMD), or you have run scripts in it. If you run a Jupyter Notebook from CMD, you have to keep the window open to make sure that your notebook server doesn’t shut down. Many…


Source: Own Work

Hello! My name is Sohit and I’m a Data Science major at Minerva Schools, San Francisco. In your assignments, It is important to write professional papers with the right formatting, labels, and citations. LaTex makes it easy to automate assignment formatting and details like matrices, equations, indents, figures, bibliography, and captions

In this tutorial, I will walk you through three simple steps to take to build a very professional assignment in LaTex. But, Does this even matter? Yes, it does. Firstly, it is a lot more efficient and professional than Google Documents. Secondly, LaTex makes it easier to write complicated…


Featured Image Source here.

Hello! My name is Sohit and I’m a Data Science major at Minerva Schools, San Francisco. Just like most of you, I’ve been through the pressure of applying for jobs and getting multiple rejections. Many factors affect your job application and while you cannot control some things, you can always make sure that your resume is flawless.

In this tutorial, I will walk you through three simple steps to take to build a very professional resume in LaTex. You may ask me a question: Does this even matter? Yes, it does. …


It was just another Random Day! But random days in Tokyo aren’t simple, they’re quite adventurous. Like the day when we were randomly walking to Shibuya and saw Neymar in person who was there for inaugurating a place. It was another random day when we entered a small door that led to a Alice in Wonderland themed store called Alice in Wednesday. It was another random day when to we went to Yoyogi park only to discover a man who was blowing a lot of bubbles. We danced in the bubbles like small children.

A picture from my gallery at 4 am that day. Apparently, the sun rises quite early in Japan, as early as 3 am.

So, it was just another random…

Sohit Miglani

Data Scientist and Computational Biologist | Research @UChicago | Class of 2020 @MinervaSchools | www.sohitmiglani.com | @sohitmiglani | sohitmiglani@gmail.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store