Understanding Functional Forms in Survival Analysis: Why Linear Isn’t Always Enough

In survival analysis (and regression modeling more broadly), one of the most fundamental—but often overlooked—questions is:

“How does a variable relate to the outcome?”

This is a question of understanding and correctly modeling the functional form of the convariates with the outcome. Getting it wrong can lead to biased estimates, misleading conclusions, and poor predictions.

This post walks through what functional form means, why it matters, and how to evaluate it in practice.

Continue reading Understanding Functional Forms in Survival Analysis: Why Linear Isn’t Always Enough →

Build the Whole Pipeline First, Then Study Where the Boxes Connect

Young scientists often struggle to develop and validate a large-scale project efficiently. Most real projects have several steps. You might segment images, extract features from the segmentations, and then associate those features with an outcome, such as a prognostic or therapy-response model.

I think of each step as a box, and of whatever passes between boxes as an interface: the data itself, its format, and the assumptions the receiving step makes about it.

Some interfaces are internal. Segmentation masks feed your feature extraction code, and the feature table feeds your outcome model. Others are external, and easy to overlook. Your raw dataset is an interface between the sampling mechanism (say, the clinic that collected the patients) and your pipeline. Who ended up in the dataset, which scanner and stain were used, and which outcomes are missing or censored are all things your pipeline silently assumes about the world. When the clinic’s sampling doesn’t match what your pipeline expects, the problem has nothing to do with any single algorithm or step. It lives at the boundary, just like the internal ones.

The natural instinct is to do each box as well as you possibly can before moving to the next.

That instinct is a trap.

Continue reading Build the Whole Pipeline First, Then Study Where the Boxes Connect →

A performance comparison of using Openslide open and read WSIs via AWS S3 for S3FS and Goofys

Background

These days, developers In digital pathology frequently use OpenSlide to read whole slide images (WSIs). Since WSIs are typically large, transferring and sharing them can be challenging. Cloud storage provides a scalable, durable, and secure solution for storing and sharing WSIs remotely. By mounting cloud storage as a local file system, existing tools can access WSIs without additional modifications.AWS S3 (Simple Storage Service) and MinIO (S3 compliant, onsite and open-source) are a widely used, robust, and highly scalable cloud storage service. While Mountpoint for AWS S3 is a promising option for treating cloud storage as a local file system, several open-source projects also allow users to mount an S3 bucket as a local file system. Among the most well-known are s3fs and Goofys. In this post, we’ll compare the performance of these two popular open-source solutions.

Continue reading A performance comparison of using Openslide open and read WSIs via AWS S3 for S3FS and Goofys →

Insertion and Query of Spatial Databases

As part of the scaling up of our QuickAnnotator tool, we executed a series of tests to benchmark backend technology. In particular, we were interested in looking at storage mechanisms for polygons which not only allow for their storage, but most importantly their spatial query. This implies that we could push geometries into a database, and then as part of a query, submit a second polygon (or bounding box) to identify those which intersect (among other spatial operations). The number of objects we were aiming for was at least 1 million rows in the database, as this is on the order of the number of unique cells within a typical whole slide image. 

We as well wanted to consider different scalability options. It should not be surprising that if one wants to have extremely high-throughput, this typically requires the usage of more than 1 machine working in concert, which at the same time comes at the cost of additional setup and support complexity. It is not clear for us at the moment how much modern hardware has eliminated this cost, i.e., is 1 million “a lot” or “a little” with current technology. Regardless, one interesting way of managing complexity is through an abstraction layer, such that the backend can be readily and easily changed, without having an impact (or as small as an impact as possible) on the code being used to interact with that database. 

Continue reading Insertion and Query of Spatial Databases →

Serialization and storage of GeoJson in Digital Pathology

GeoJSON, a widely used format based on JSON (JavaScript Object Notation), is specifically designed for encoding a variety of geographic data structures. This versatile format excels in representing simple geographical features, such as points, lines, and polygons, along with their non-spatial attributes. In the realm of digital pathology, GeoJSON has emerged as a common format for storing annotations, enabling precise documentation of regions of interest, cellular structures, and other critical details within pathology images. The popularity of GeoJSON in this field is bolstered by its broad support across numerous tools (e.g., Qupath) and thus facilitates seamless integration and analysis in digital pathology workflows.

Despite its widespread adoption, there are several open questions regarding the efficient use of GeoJSON that can significantly impact performance. One key concern is the best method for storing GeoJSON in a compressed format to minimize storage requirements while preserving the integrity of the data. Efficient compression techniques are crucial, especially when dealing with large-scale pathology datasets.

Continue reading Serialization and storage of GeoJson in Digital Pathology →

Data Exploration Of Features For Outcome Association In Digital Pathology

Introduction

In the field of digital pathology, a frequent approach for the creation of image-based biomarkers involves extracting features from scanned pathology slides. These features, which are often related to the morphology or spatial distribution of various tissue or cell types, provide valuable insights into the underlying biology of diseases. In cancer research, it is particularly important to examine how these features correlate with clinical outcomes such as overall survival (OS), progression-free survival (PFS), or other binary outcomes (e.g., response to a specific treatment).

Here we release python code that can be executed in a notebook to facilitate this process. It accepts a pandas DataFrame and generates a one-page summary PDF file, facilitating the analysis of individual features and their potential correlation with clinical outcomes.

Continue reading Data Exploration Of Features For Outcome Association In Digital Pathology →

Ray: An Open-Source Api For Easy, Scalable Distributed Computing In Python – Part 3 Intro to Serving Models

Through a series of 4 blog posts, we’ll discuss and provide working examples of how one can use the open-source library Ray to (a) scale computing locally (single machine), (b) distribute scaling remotely (multiple-machines), and (c) serve deep learning models across a cluster (2 on this topic, basic/advanced). Please note that the blog posts in this series increasingly raise in difficulty!

This is the second to last blog post in the series, (the first one here, second one here), where we will go into greater detail about how we can use Ray Serve to set up a server waiting to respond to our requests for processing. These last two are the most complex blogpost in the series and require some understanding of how HTTP, REST, and web services work. You can find relevant prereading here.

Ray Serve is a scalable model serving library for building online inference APIs. Serve is framework agnostic, so you can use a single toolkit to serve everything from deep learning models built with frameworks like PyTorch, Tensorflow, and Keras, to Scikit-Learn models, to arbitrary Python business logic.

Continue reading Ray: An Open-Source Api For Easy, Scalable Distributed Computing In Python – Part 3 Intro to Serving Models →

Ray: An Open-Source API For Easy, Scalable Distributed Computing In Python – Part 2 Distributed Scaling

Through a series of 4 blog posts, we’ll discuss and provide working examples of how one can use the open-source library Ray to (a) scale computing locally (single machine), (b) distribute scaling remotely (multiple-machines), and (c) serve deep learning models across a cluster (basic/advanced). Please note that the blog posts in this series increasingly raise in difficulty!

This is the second blog post in the series, (the first one here), where we will go into greater detail about how Ray Cluster creation works, associated terminology, requirements for successful execution, and extend our previous local-only example to a distributed environment.

Continue reading Ray: An Open-Source API For Easy, Scalable Distributed Computing In Python – Part 2 Distributed Scaling →