Skip to content
Honghan Wu edited this page Sep 23, 2016 · 1 revision

Example: Medication Episode Encoding for an Adverse Drug Event

*Figure 1. The bitwise encoding of dynamic medication episodes for a given adverse event*

Figure 1 illustrates an example encoding scenario. The upper part shows the sample medication episodes of a patient that are related to a certain inspecting time spot (marked as AE date in the figure). The encoding is realised through the following steps.

  1. From the the inspecting time spot, look back to a certain period of time, e.g., 20 days. In our experiments, we selected 30 days.
  2. Split the time period into intervals using a unit of time, e.g., a day or a week. Number each interval in an ascendent order (started from zero) starting from the inspecting time spot. For example, 4 intervals are identified and numbered in Figure 1.
  3. Add the patient's medication episodes to the timeline.
  4. For each medication episode, allocate a sequence of bits aligned with the interval order we obtained in step 2. The interval numbered zero is aligned with the most significant bit in the sequence. For each interval, set the corresponding bit to 1 if the interval intersects with the episode, and to 0 otherwise. For example, Medication Episode 2 (M2) in Figure 1 spans across interval number 1 and 2. Its encoding is 0110 in binary code.
  5. Repeat step 4 for all medication episodes. We will get a vector representing all the relevant medication episodes of the inspecting time spot.

The resulting bitwise encoding has the following features:

  • Simple and Succinct: Each medication episode is represented as a numeric value which can used as the feature value in a predictive model which can be consumed by most machine learning algorithms.
  • Informative: The encoded number conveys both the duration information of an episode (i.e. occurrences across multiple time intervals are recorded in their corresponding bits) and also the distances of each occurrence (i.e., the orders of bits in the number). For example, for duration, M2 crosses two intervals and its encoded number has two bits set as 1 accordingly; for distances, M1 and M3 are both present in only one interval. However, M3 is encoded as 8 because it is closer to the event, while M1 is represented as 1.
  • Flexible Different units of time can be used in step 2, enabling variable levels of granularity. For example, if the unit used is 4 times bigger in Figure1, all three medication episodes will be encoded as 1. The same number of bits can cover medication periods that are four folds longer. The obvious loss of information however must be taken into account when choosing a time unit.
Clone this wiki locally