Index ¦ Archives ¦ Atom

Preparing Image Dataset for Neural Networks in PyTorch

Preparing and handling data is a core step of any machine learning pipeline. Today, we will look at handling data when the data is an image (or image-like) in PyTorch.

PyTorch and Torchvision

PyTorch provides us with the amazing torchvision package for dealing with common image transformations such as normalizing …


The Coding Kata

A coding kata is an exercise to sharpen your programming skills and muscle memory via repetition. I learnt this concept when I was reading The Clean Coder (highly recommended!) and have since adopted it as part of my programming routine. It helps my hands "know" what to type when I …


Plotly.py main theme in Plotly.js

If you're like me who is used to using Plotly.py (i.e. Plotly Python) and then suddenly decided to use Plotly.js directly, you might immediately realize that there are some significant differences in terms of the plot design.

Plotly Python Plot

For one, your default plot in Plotly.js has a …


Unit Testing with pytest

Post header

It is a common scene that we want to test our functions after we've done writing them. In Python, we can usually do this by printing to the console. For example, suppose we are interested in testing the following function:

def add_positive(x, y):
    """Add two positive integers x and …

Relational Databases in Python (part I)

Post header

We usually hear the word databases being thrown around especially when talking about data-related things. So what is it, and what is the more precise term relational databases?

A relational database is like an Excel file. It is made up of tables (note that this is plural) which holds data …


Making pastel-colored boxes using tcolorbox in LaTeX

One of the many questions I get when people see my \(\LaTeX\)-ed math notes is how do you create these nice pastel-colored boxes?

Example tcolorbox Example 2 tcolorbox

Two examples of pastel-colored boxes from my math notes

I feel like this is a very relevant and important question, because I asked the exact same …


Root-hunting algorithm: Newton's method

Problem: Given a real-valued function \(f(x)\) in one real variable, what are the values \(x_0 \in \mathbb{R}\) such that \(f(x_0) = 0\)?

If the function \(f(x)\) is linear, then the problem is trivial. Explicitly, if \(f(x) = ax + b\) for some \(a, b \in \mathbb{R}\), then …


Blogging again!

I've been an active blogger since 2011 up until 2016 (although most of the earlier contents are now hidden due to cringiness) where I talked about various things – life events, some tech stuff and my scholarship interview experiences. I stopped blogging when I started my International Baccalaureate (IB) diploma program …

© Salman Faris. Built using Pelican. Theme by Giulio Fidente on github.