A list of all the posts and pages found on the site. For you robots out there is an XML version available for digesting as well.



Siamese network and triplet loss

less than 1 minute read


Siamese network is an architecture which runs two networks with shared weights (effectively runs the same network twice) on two different inputs simultaneously. It is commonly trained with a contrastive loss such as triplet loss in order to draw together the representations of similar inputs and push apart the representations of contrasting inputs.

Get filepath of Bash activation script

less than 1 minute read


Use ${BASH_SOURCE[0]} to reference the filepath of a Bash script. Unlike $0, this works if the script is called via bash or source

Beware any vs len

less than 1 minute read


I fell into the habit of using any() to check if a list is empty. It’s nice because it works for any enumerable, including generators, even if len() is not defined. However, it has a pitfall where if the list is nonempty but contains only falsy values, any() returns False. For this reason, I advise to use len() to check if a list is empty.

Use head -n -0 to get all items in list

less than 1 minute read


You may know that you can use head -n $n to get the first N lines of a list. But you may not know that you can supply n=-0 to get all items in the list.

Use hard links to replicate log files in a generated directory

1 minute read


Recently I wanted to write program logs to a file, then copy it to the directory where I store my checkpoints. Because I want to log things before I create the checkpoint directory, I attached my logger to a file in my root directory.

Beware metric auto-reduce with PyTorch Lightning + TorchMetrics

1 minute read


PyTorch Lightning + TorchMetrics can log metrics per step and per epoch. It also has MetricCollection, which can be used to compute several metrics at once, getting rid of redundant code. Here is how I have it set up:

Print pandas Series as percent

less than 1 minute read


Use this snippet to print a pd.Series of floats as percentages.

.apply(lambda x: x * 100).apply("{:,.2f}%".format)

Encoder-decoder models

less than 1 minute read


Encoder decoder is a deep neural network architecture that consists of 2 components:

  • Encoder: input -> encoder memory (real-valued vector),
  • Decoder: encoder memory -> output. Input is variable length, encoder memory is fixed length.

Print item keys with jq

less than 1 minute read


I can use jq to print the keys in an array of JSON objects quickly.

jq '.[0] | keys[]' $filename

Neural Network Embeddings

less than 1 minute read


Embeddings are used to map high-dimensional data to low-dimensional floating-point representation. This may improve the performance because it improves the representation of the input given to the model.

Meditations on Meditations: I-IV BLOG

10 minute read


I’m reading Marcus Aurelius’s Meditations in Marcus Aurelius and His Times (Transition from Paganism to Christianity) [0].

No pain no gain? Comparing 3 program analysis frameworks for C BLOG

11 minute read


Program analysis methods often represent programs as graphs. These graphs should be automatically generated from the source code. There are many tools that have been implemented to do this, but they are often painful to set up. In this post, I will compare 3 program analysis frameworks which I have used to generate graph representations of C programs.



A relation between flexibility and thermal conductivity of polymers RESEARCH PAPER

Published in Preprints, 2020

Flexibility of polymers defined by an equation in 2019 is related here to thermal conductivity, using reliable data for both properties found in the literature. The resulting equation is simple, it has the form of a quadratic polynomial.

Recommended citation: Brostow, W.; Fałtynowicz, H.; Zhang, D. A Relation Between Flexibility And Thermal Conductivity of Polymers. Preprints 2020, 2020060230

Mechanical and tribological properties of polymers and polymer-based composites RESEARCH PAPER

Published in Chemistry & Chemical Technology, 2020

We also discuss tribological properties of polymers and PBCs including frictions (static, sliding and rolling) and wear. We discuss connections between viscoelastic recovery in scratch resistance testing with brittleness B, as well as Charpy and Izod impact strengths relations with B. Flexibility Y is related to a dynamic friction.

Recommended citation: Brostow, Witold, et al. "Mechanical and tribological properties of polymers and polymer-based composites." Chem Chem Tech 14 (2020): 514-520.

Mechanisms of liver injury in high fat sugar diet fed mice that lack hepatocyte X-box binding protein 1 RESEARCH PAPER

Published in PloS One, 2022

In this study, to better understand the role of liver XBP1 in the pathobiology of NAFLD, we fed hepatocyte XBP1 deficient mice a HFS diet or chow and investigated UPR and other cell signaling pathways in hepatocytes, hepatic stellate cells and immune cells.

Recommended citation: Liu X, Taylor SA, Gromer KD, Zhang D, Hubchak SC, LeCuyer BE, Iwawaki T, Shi Z, Rockey DC, Green RM. Mechanisms of liver injury in high fat sugar diet fed mice that lack hepatocyte X-box binding protein 1. PLoS One. 2022 Jan 14;17(1):e0261789. doi: 10.1371/journal.pone.0261789. PMID: 35030194; PMCID: PMC8759640.

Hepatic Deletion of X-Box Binding Protein 1 in FXR Null Mice Leads to Enhanced Liver Injury RESEARCH PAPER

Published in JLR, 2022

In this paper, we sought to determine the role of the inositol-requiring enzyme 1α/XBP1 pathway in hepatic bile acid toxicity using the Fxr−/− mouse model.

Recommended citation: Liu, Xiaoying, et al. "Hepatic Deletion of X-box Binding Protein 1 in Farnesoid X Receptor Null Mice Leads to Enhanced Liver Injury." bioRxiv (2022).



Teaching Assistant for MATH 355

MATH 355, Rice University, Department of Mathematics, 2022

Graded assignments of 65+ students and tutored topics such as Matrix Operations, Eigenvalues, Determinants, Gram-Schmidt Process.

Teaching Assistant for COMP 140

COMP 140, Rice University, Department of Computer Science, 2022

Host weekly office hours for 350+ undergraduates and offer feedback on algorithmic concepts, exams, and homework assignments. Teach concepts such as Markov Models, A* Search Algorithm, Depth-First Search, Breadth-First Search, Matrices, Probabilistic Models.

Teaching Assistant for COMP 215

COMP 215, Rice University, Department of Computer Science, 2023

Instruct 250+ students in COMP 215 in object-oriented programming, test-driven development, and Java projects.