<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Ad Scientiam Stories - Medium]]></title>
        <description><![CDATA[At the heart of Ad Scientiam’s project is a conviction: measuring and monitoring the evolution of serious and disabling diseases on a continuous basis and in real life is essential for better management. - Medium]]></description>
        <link>https://medium.com/ad-scientiam-stories?source=rss----2246370c9a54---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Ad Scientiam Stories - Medium</title>
            <link>https://medium.com/ad-scientiam-stories?source=rss----2246370c9a54---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 15:42:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ad-scientiam-stories" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Association vs. agreement for method comparison, which one should be considered in clinical study?]]></title>
            <link>https://medium.com/ad-scientiam-stories/association-vs-agreement-for-method-comparison-which-one-should-be-considered-in-clinical-study-d426cbe4fc50?source=rss----2246370c9a54---4</link>
            <guid isPermaLink="false">https://medium.com/p/d426cbe4fc50</guid>
            <category><![CDATA[comparison]]></category>
            <category><![CDATA[clinical-trials]]></category>
            <category><![CDATA[biostatistics]]></category>
            <category><![CDATA[agreement]]></category>
            <category><![CDATA[methodology]]></category>
            <dc:creator><![CDATA[Lea Diouf]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 11:51:33 GMT</pubDate>
            <atom:updated>2022-09-06T11:51:33.111Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v3eg5uGDwPQEkTHVTLY4PQ.png" /><figcaption><a href="https://www.shutterstock.com/">https://www.shutterstock.com/</a></figcaption></figure><p>The comparison<em> </em>is a very common objective in clinical studies to assess equivalency, i.e., define whether the A and B methods are statistically comparable. Is there an obvious statistical method to do so? Unfortunately, the short answer is no. The longer one is: although there is no consensus in the literature, I will try to demonstrate that we have all the information required to handle such an objective.</p><p>Here at Ad Scientiam, we develop, validate and implement digital biomarkers that continuously measure the evolution of the disease in real life. Accordingly, these digital biomarkers have to be compared with existing tools used in routine and therefore, the statistical comparison of two measurement methods, <em>(eg., assays, procedures, measurement systems, etc.),</em> is considered.</p><p>This article will present the most common approach that is used in the literature so far, even though it isn’t appropriate in the vast majority of the said articles. Then, I will lead you through a more appropriate approach for comparison studies and explain why as biostatisticians, we should spread the word.</p><h4><strong>The ugly duckling technique: correlation</strong></h4><p>In a first instance, the correlation coefficient seems to be the best statistical method to assess equivalency between two methods and is actually the most common approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/0*vmr-ylnytXdZ6Vbo" /><figcaption><a href="https://exnessblog.com/fr/qu-est-ce-que-la-correlation-des-devises-dans-le-trading-forex-comment-ca-marche-dans-exness-0001477">https://exnessblog.com/fr</a></figcaption></figure><p>As a reminder, the Pearson or product-moment correlation shows whether and how strongly pairs of variables are related. The correlation coefficient is computed as the ratio of covariance to the product of their standard deviations. When the correlation coefficient value is closer to +1 or -1, it indicates there is a stronger linear relationship between the two variables.</p><p>The null hypothesis of linear regression (mostly performed with correlation) is based on a non linear relationship. Showing such a result is obvious, even with a minimal trend. Thus, sometimes analyses can incorrectly conclude that two measurement methods are related.</p><p>If you feel that handling dummy data would help you understand the correlation, I invite you to try this interactive tool: <a href="https://rpsychologist.com/correlation/">https://rpsychologist.com/correlation/</a>.</p><h3>What about agreement?</h3><p>However, in our comparison, we want to demonstrate the way in which two methods of taking measurements agree. The agreement refers to the degree of concordance between two methods of measurements. Statistical methods to test agreement are used to decide whether one technique for measuring a variable can substitute another.</p><p>In correlation, the two methods designed to measure the same variable should have strong correlation when a set of samples are chosen in such a manner that measurements to be determined vary widely. In the case of method comparison, this means that samples should cover a wide value range. A high correlation designed to measure the same measurements could just be a sign that one method has chosen a widespread sample. Correlation quantifies the degree to which two variables are related but a high correlation does not automatically imply that there is good agreement between the two methods.</p><p>Pearson correlation coefficients have to be interpreted cautiously: the measures of association between two methods is not a measure of agreement.</p><h3>Right, but is there another solution now?!</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxT1R9AlhpSvjjil46A%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fheyarnold-hey-arnold-nicksplat-xT1R9AlhpSvjjil46A&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FxT1R9AlhpSvjjil46A%2Fgiphy.gif%3Fcid%3D790b7611fa03d8c019f2b99728e9ffd059f7572b5b995274%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa8f7da324108e71815a979c653dd7fe/href">https://medium.com/media/aa8f7da324108e71815a979c653dd7fe/href</a></iframe><p>Don’t panic! It has been generally accepted that the Bland and Altman approach is the most appropriate technique for studying measurements methods comparison. This approach is simple and can be used along with the correlation approach to avoid misinterpretation of the correlation coefficient.</p><h3>The most appropriate technique: Bland Altman approach</h3><p>Bland and Altman’s <em>(B&amp;A)</em> approach is a difference plot which examines the differences between the two methods and studies the agreement in terms of Limit of Agreement (LoA). The B&amp;A plot represents each measurement difference between two paired methods against the average of the measurement. The aim is to evaluate the agreement between the two measurements, hence, the behaviors of the differences, between one measurement and the other, are statistically studied. The hypothesis is that the measurements obtained by one method or another, gave similar results, with an acceptable range of course ie., the so-called limit of agreement. So, all the differences would be equal to zero. To note, if one of the two methods is a reference (gold standard), the difference plot can represent every difference between two paired methods against the reference method measurement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*3VHySjC-MpW0Ph6_m5fD3w.png" /><figcaption><a href="https://www.medcalc.org/manual/sample-size-bland-altman.php">https://www.medcalc.org/manual/sample-size-bland-altman.php</a></figcaption></figure><h4>This approach allows:</h4><ul><li>to evaluate the agreement between the two measurements</li><li>to statistically study the behaviors of the differences between one measurement and the other <em>(bias: do the differences differ systematically from zero?)</em></li><li>to assess errors <em>(how much do the differences vary?)</em></li></ul><p>The LoA include both systematic (bias) and random error (precision), and provide a useful measure for comparing the likely differences between individual results measured by two methods. Limits of agreement can be derived using a parametric method given the assumption of normality of the differences (mean difference +/- 1.96 SD) or using non-parametric percentiles when such assumptions do not hold. A clinical LoA can also be determined a priori if relevant.</p><h3>So, let’s take a closer look!</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FfYq1hQ9natygIWGeDt%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fbrownsugarapp-come-again-are-you-sure-closer-look-fYq1hQ9natygIWGeDt&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FfYq1hQ9natygIWGeDt%2Fgiphy.gif%3Fcid%3D790b7611dd8b6e9949a1d1b21e0ad959bc88a1eb65b75979%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/d603a91cd9126a469c755232e57e1725/href">https://medium.com/media/d603a91cd9126a469c755232e57e1725/href</a></iframe><h4>Comparison between correlation and the Bland-Altman approach</h4><p>The same data is used for the correlation and the Bland Altman plots?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*5ohdcnOY1BBRS76IfjkpPA.png" /><figcaption><strong>Figure 1</strong>. The regression line between method A and method B measurements — <strong>Figure 2.</strong> Plot of differences between method A and method B <em>vs</em>. the mean of the two measurements</figcaption></figure><p>In figure 1, the regression line has a <strong>slope of 1.06 </strong>(1.02 to 1.09) and an <strong>intercept of 7.08 (-0.30 to 19.84). </strong>The correlation coefficient between the two methods is <strong>r = 0.996 (0.991–0.998), P &lt; 0.001 </strong>and<strong> </strong>shows<strong> </strong>a strong correlation.</p><p>However, as shown in figure 2, a <strong>bias of -27.2 units</strong> is found. The bias is represented by the gap between the X axis, corresponding to a zero difference, and the parallel line to the X axis at -27.2 units.</p><p>This example shows that correlation can quantify the degree of relation between two variables, but a high correlation does not automatically imply that there is good agreement between the two methods.</p><h3>Let’s conclude…</h3><p>Correlation between two methods:</p><ul><li><em>is misleading and does not measure agreement</em></li><li><em>should not be used to assess the method comparability</em></li></ul><p>The evaluation between two measurements depends on the goal of the study:</p><ul><li><em>to study the significance of differences: focus on the differences</em></li><li><em>to study the equivalence or the comparability: focus on the agreement</em></li></ul><p>To note, the tendency to imitate what we observed in other published papers and the fact that many papers used the same incorrect association methods encourage sometimes to use systematically low quality statistical methodology by replication. Statisticians should be aware of this problem and use their influence to convince their uninitiated colleagues. It is important at Ad Scientiam to apply relevant statistical methods to be sure that the digital biomarkers are valid and can bring concrete added value compared to the existing tools. This is innovation without compromise!</p><h4>And now let’s practice with some R code!</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oKIPnAiaMCws8nOsE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcat-kitten-computer-3oKIPnAiaMCws8nOsE&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZ2NndXZlNTNwMzB5MzlvNjAwZXg2cjNsNHdpZmcyanpla3Z4a2d0MSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F3oKIPnAiaMCws8nOsE%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a0fe70d6f3b099ee8853f684694b4d1/href">https://medium.com/media/4a0fe70d6f3b099ee8853f684694b4d1/href</a></iframe><p>Here, an example of a high correlation of 0.91 with a poor agreement (bias of 24 units taking 0 units as reference of a good agreement), is shown with a R script.</p><pre><em>#Do not forget to install the required R packages before loading them if necessary</em></pre><pre>#Install packages<br>install.packages(<em>ggplot2</em>) <em>## graphs</em><br>install.packages(<em>blandr</em>)  <em>## Bland Altman</em><br>install.packages(<em>ggpubr</em>)  <em>## arrange plots</em></pre><pre><em>#Load packages<br>library(ggplot2) <br>library(blandr) <br>library(ggpubr) </em></pre><pre><em>#Data<br>data = data.frame(value_2 = c(44, 45, 41, 53, 44, 44, 50, 45, 60, 57, 47, 52, 54, 62),<br> value_1 = c(22, 22.5, 20.5, 26.5, 20, 23, 25, 22.5, 30, 28, 23, 26, 32, 30))</em></pre><pre><em>#Correlation plot<br>my_cor_Plot = ggplot(data, aes(x=value_2, y=value_1)) + <br> geom_point() + <br> theme_bw()+ <br> geom_smooth(method=lm, se=FALSE) +<br> ggtitle(“Pearson Correlation”)</em></pre><pre><em>#Correlation test<br>my_cor_Test = cor.test(x = data$value_2, y = data$value_1, method = “pearson”)</em></pre><pre><em>#Bland-Altman plot<br>my_BA_Plot = blandr.draw( data$value_2, data$value_1 ) +<br> geom_point( )</em></pre><pre><em>#Bland-Altman statistics (bias, LoAs limits, CIs, means, differences and other statistics estimations)<br>my_BA_Stat = blandr.statistics(data$value_2, data$value_1)<br>my_BA_Bias = my_BA_Stat$bias</em></pre><pre><em>#Arrange plot<br>my_plot = ggarrange(my_cor_Plot, my_BA_Plot, nrow = 1, ncol = 2)</em></pre><pre><em>#Print<br>print(my_plot)</em></pre><p>Thank you for reading my article!</p><h4><strong>References</strong></h4><p><a href="http://smm.sagepub.com/content/8/2/135.short">Bland, J. M., &amp; Altman, D. G. (1999). Measuring agreement in method comparison studies. <em>Statistical methods in medical research</em>, <em>8</em>(2), 135–160.</a></p><p><a href="http://www.amazon.com/Comparing-Clinical-Measurement-Methods-Statistics/dp/0470694238/">Carstensen, B. (2011). <em>Comparing clinical measurement methods: a practical guide</em>. John Wiley &amp; Sons.</a></p><p><a href="http://clinchem.aaccjnls.org/content/48/6/919.short">Krouwer, J. S. (2002). Setting performance goals and evaluating total analytical error for diagnostic assays. <em>Clinical Chemistry</em>, <em>48</em>(6), 919–927.</a></p><h4><strong>Links</strong></h4><ul><li><a href="https://www.linkedin.com/company/ad-scientiam/">Ad Scientiam | LinkedIn</a></li><li><a href="https://www.linkedin.com/in/leadiouf/">Léa Diouf - Lead Biostatistiques - Data management clinique - Programmeur R - Ad Scientiam | LinkedIn</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d426cbe4fc50" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ad-scientiam-stories/association-vs-agreement-for-method-comparison-which-one-should-be-considered-in-clinical-study-d426cbe4fc50">Association vs. agreement for method comparison, which one should be considered in clinical study?</a> was originally published in <a href="https://medium.com/ad-scientiam-stories">Ad Scientiam Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The science behind the data N°3 —  The advantages of Parallel Categorical Diagrams]]></title>
            <link>https://medium.com/ad-scientiam-stories/the-science-behind-the-data-n-3-the-advantages-of-parallel-categorical-diagrams-708f8059d7fb?source=rss----2246370c9a54---4</link>
            <guid isPermaLink="false">https://medium.com/p/708f8059d7fb</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Angéline Plaud, PhD in computer science]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 15:39:04 GMT</pubDate>
            <atom:updated>2022-04-28T08:46:54.816Z</atom:updated>
            <content:encoded><![CDATA[<h3>The science behind the data N°3 — The advantages of Parallel Categorical Diagrams</h3><p>A multimodal feature is a special case of features computation, which therefore requires special visualization tools.</p><p>Here we will present multimodal feature examples and compare three different visualization methods based on a use case developed by <a href="https://www.adscientiam.com/en/">Ad Scientiam</a>.</p><h3>Features with modality</h3><p>Massive amounts of data are continuously generated all around the world these days. Most of the time, the collected data is raw and requires interpretation as well as transformation processes in order to turn it into a meaningful and goal-specific measure called a <strong>feature</strong>.</p><p>An example of such a feature would be the transformation of a GPS signal (e.g., x and y position) into a walking distance (in meters), which constitutes a clear and straightforward measure.</p><p>What would be the purpose of doing that? At Ad Scientiam, we design and validate digital biomarkers that continuously measure disease progression in real life. In this way, we help people with severe and disabling diseases to better understand and monitor their illness. We are paving the way for healthcare professionals to offer more individualized care more efficiently. We are accelerating the development of future treatments and reducing the societal and economic impacts of disease.</p><p>In this context, our data team oversees the creation of features that, through clinical validation, will become disease biomarkers. From the raw data provided by the mobile phone, we compute the said features that can then be fed into machine learning models in order to evaluate the patient’s condition, to track the disease progression or to predict treatment response, for instance.</p><p>However, as some data enthusiasts already know, machine learning generalization can be a delicate process if the input features are poorly defined.</p><p>Indeed, in the field of data-analysis, features are often subject to various biases that influence the transformation process.</p><p>One known way to limit these biases is to introduce environment parameters called modalities. Multiple modalities can affect one feature, allowing the generation of <strong>multimodal features</strong>.</p><p>Thus, a multimodal feature is a representation of the same archetypical measure, but in a sub-environment associated with its dependent modalities.</p><p>As an example, let’s take one of our active tasks available in the MSCopilot® application: the Dexterity Test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*Q9pOkv-XqdDpgHlm" /></figure><blockquote>The dexterity Test is a specific task for Persons Living with Multiple Sclerosis (PLwMS) proposed in our medical device application MSCopilot®. This test measures the patient’s upper-limb dexterity and hand-eye coordination. During this test, PLwMS are instructed to use their finger to draw different shapes displayed on their phone.</blockquote><p>Based on the raw screen data collected during the dexterity task, it may be possible to capture patients’ performance via the computed distance between the displayed shape and the user drawing, i.e., the similarity score. However, reducing the user performance to one unique measure introduces an inherent bias due to its aggregation across multiple shapes.</p><p>In fact, the hypothesis behind data aggregation implies that all sub-environments fall within the same representational category. Aggregating the similarity scores of the spiral and line shapes is therefore inappropriate, since the level of difficulty involved in tracing these two shapes differs.</p><p>Thus, a similarity score needs to be created for each shape. The displayed shape then constitutes a modality for the similarity feature.</p><p>It is possible for features to depend not just on one but on multiple modalities. In the dexterity test, for instance, it is known if the shape was drawn using the dominant or the non-dominant hand.</p><p>Thus, an archetypical feature could be configured for multiple modalities that can be visualized, analyzed and compared.</p><p>In case of features with multiple modalities, visualizing their relationship can be quite challenging. In fact, traditional visualization tools allow us to study only one or two modalities at a time (when using multiple violin plots, for example). However, studying a higher number of features together, along with their intricate dependencies, might be a laborious task, as we will see shortly.</p><p>To go back to the dexterity test example, if multiple modalities are available, such as the dominant/non-dominant hand and the shape, we might be interested in looking at the impact of the type of hand used on the shape, and vice versa.</p><p>The idea is to be flexible regarding the modalities order of the visualization in order to study their impact on the feature more easily.</p><h3>Multimodal features visualization ideas</h3><p>Visualization is an important step when exploring the information contained in a feature dataset. Consequently, the visualization tools used should be adapted to the features, which in our case are the multimodal ones. Several choices are available to explore these types of data, from basic histograms to fancy mosaic views.</p><p>Using the example of a test called MyEmotion, we will compare the adaptability of these traditional visualization tools by presenting this test’s features via a histogram, a mosaic view, and lastly, a parallel categorical diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/0*LXxg3rgy0P-au8-Z" /></figure><blockquote>The <em>MyEmotion </em>Test is a specific task proposed in <strong><em>Redress</em></strong>, our mobile application for patients with major depressive disorder. It is currently being evaluated in a clinical study to assess its ability to predict antidepressant response in real-life. This project is a collaboration between Ad Scientiam and Janssen Pharmaceutica NV, part of the Janssen Pharmaceutical Companies of Johnson &amp; Johnson. It was facilitated by Johnson &amp; Johnson Innovation.</blockquote><p><em>MyEmotion </em>consists of recognizing the emotion seen on a human face that is quickly displayed on a phone screen. Four emotions {anger, happiness, sadness, fear} performed by professional actors {woman, man} are shown with expressions of varying degrees of intensity {very low, low, moderate, high, very high}.</p><p>Here, to evaluate the pertinence of each tool, we’ll visualize the correct answers given by a pool of healthy control subjects from a total of 214 evaluations.</p><h4>Histogram</h4><p>Let’s start with the histogram that reports feature value frequency. We will visualize the correct answers feature across multiple subsets, where each subset corresponds to one of the following modalities:</p><ul><li>emotion: {angry, happy, sad, afraid}</li><li>actor: {woman, man}</li><li>intensity: {very low, low, moderate, high, very high}</li><li>answer: {correct, incorrect}</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2vTgXn2DGGAJZs9P" /></figure><p>What can we interpret from this figure? Not as much as one could hope. Indeed,<br>this representation is rather difficult to read. Furthermore, the link between<br>the modality states that would be especially interesting to explore is missing, making this tool less useful. Let us consider the next option.</p><h4>Mosaic view</h4><p>Seeing that histograms may not be the most appropriate tool for this kind of visualization, let us try using the mosaic view. This visualization tool can also project the same information as above, but under the form of ratio areas. The more frequent the feature value in the dataset, the larger the represented area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r9MnMhF4tYlqloRp" /></figure><p>Is it possible to glean insightful information from this visualization? Most likely not. While the link between the correct and incorrect answers appears here, the modality link between the intensity states is still missing, which limits the information gained.</p><p>Overall, the two visualization tools described above suffer from the same weaknesses:</p><ul><li>A poor readability.</li><li>An unclear representation of the relationship between the modality states.</li><li>A maximum projection of three modalities.</li></ul><p>Indeed, in the presented examples, the overlapping or repeated axes lead to numerous information elements being displayed in the same figure subspace, which makes it hard to read the charts and to have a global view.</p><p>In addition, the intra-modality relationships are difficult to interpret, as the final graph is static, making it difficult to inverse the modality order in the projection.</p><p>Finally, the projected modality maximum number is three, which is quite a limitation in real-world applications.</p><p>Considering the above limitations, let us now look at the third visualization option, the parallel categorical diagram.</p><h4>Parallel Categorical Diagram</h4><p>The <strong>parallel categorical diagram</strong> may be the more adapted visualization solution that we have been looking for.</p><p>It allows the dynamic representation of multiple modalities, and the modality position can be switched at any time, guaranteeing the ability<strong> to study the modality impacts on the feature</strong> in any order.</p><p>What’s more, it is very readable as the projection is linear from left to right, and the stream flow representation that grows with the value of importance makes it easy to spot the most important relationship between the modalities and the results.</p><p>Here, we use the <a href="https://plotly.com/">plotly</a> implementation, but it can also be found in <a href="https://matplotlib.org/">matplotlib</a> and <a href="https://seaborn.pydata.org/">seaborn</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*UnT5c571I_2NegA6" /></figure><p>Finally, the proportions for each modality state can be visualized over the rest of the modalities just by interacting with its representation, as shown in the figure above. There is no limitation on the number of projected modalities, nor on the number of different states for each modality. You only need common sense to ensure the readability of the figure!</p><p>To sum up, we consider this to be quite a powerful and useful tool depending on the type of features you are studying. We wanted to share this insight with other data aficionados.</p><p>We hope you have learned something today. Stay tuned for more tips on data science.</p><p>Here are the code snippets of the figures displayed in the article. Enjoy :)</p><p><strong>Histogram:</strong></p><pre>freq_df = df.groupby(<br>    [‘modality_1’, ‘modality_2’, ‘modality_3’, ‘feature_value’]<br>).size().reset_index(name=’Count’)</pre><pre>fig = make_subplots(<br>    rows=1, cols=2, <br>    subplot_titles=(“Modality 1 state 1”, “Modality 1 state 2”)<br>)</pre><pre>mod11_feat1_df = freq_df.loc[ (freq_df[‘modality_1’]==’state_1&#39;) &amp;                                         (freq_df[‘feature_value’]==0.0)]</pre><pre>x = [mod11_feat1_df[‘modality_2’], mod11_feat1_df[‘modality_3’]]</pre><pre>fig.add_trace(<br>    go.Bar(x=x, y=mod11_feat1_df[‘Count’], name = ‘name’),<br>    row=1, col=1<br>)</pre><pre>mod11_feat2_df = freq_df.loc[(freq_df[‘modality_1’]==’state_1&#39;) &amp; (freq_df[‘feature_value’]==1.0)]</pre><pre>x = [mod11_feat2_df[‘modality_2’], mod11_feat2_df[‘modality_3’]]</pre><pre>fig.add_trace(<br>    go.Bar(x=x, y=m_right_df[‘Count’], name = ‘name’),<br>    row=1, col=2<br>)</pre><pre>fig.show()</pre><p><strong>Mosaic:</strong></p><pre>grouped_df = df.groupby(<br>    [‘modality_1’, ‘modality_2’, ‘feature_value’]<br>)[‘feature_value’].count()</pre><pre>fig,ax = plt.subplots(figsize=(20,15))</pre><pre>fig, _ = mosaic(<br>    grouped_df,<br>    ax=ax,<br>    gap=0.01,<br>    labelizer=lambda k: grouped_df.loc[k] if k in grouped_df.index    else ‘’,<br>    title= “answers accuracy”<br>)</pre><p><strong>Parallel categories:</strong></p><pre>import plotly.graph_objects as go</pre><pre>fig = go.Figure(go.Parcats(<br>    dimensions=[<br>        {‘label’: ‘Modality 1’, ‘values’: df.modality_1}, <br>        {‘label’: ‘Modality 2’, ‘values’: df.modality_2},<br>    ]<br>))<br>fig.show()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708f8059d7fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ad-scientiam-stories/the-science-behind-the-data-n-3-the-advantages-of-parallel-categorical-diagrams-708f8059d7fb">The science behind the data N°3 —  The advantages of Parallel Categorical Diagrams</a> was originally published in <a href="https://medium.com/ad-scientiam-stories">Ad Scientiam Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How 8 years can change a logo]]></title>
            <link>https://medium.com/ad-scientiam-stories/how-8-years-can-change-a-logo-e8f6d4bf7526?source=rss----2246370c9a54---4</link>
            <guid isPermaLink="false">https://medium.com/p/e8f6d4bf7526</guid>
            <category><![CDATA[logo]]></category>
            <category><![CDATA[entrepreneur]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Ilan Verdier]]></dc:creator>
            <pubDate>Wed, 30 Mar 2022 15:23:02 GMT</pubDate>
            <atom:updated>2022-03-30T15:23:02.476Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Sometimes, as a designer, you look at some of your company’s graphic assets and you say to yourself : “This could use some work”. It could be the company poster that’s been hanging on a wall for years, it could be the sticker you got on your first day and that you put on your laptop…</em></p><p><em>Or it could be the logo.</em></p><p>Ad Scientiam is a Parisian startup specialized in the development of softwares as medical devices on smartphones and the creation of digital biomarkers.</p><blockquote><em>Ad Scientiam aims to improve the everyday life of the patient suffering from particular chronic diseases like multiple sclerosis for instance.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Yv203H57VlG5gZKu.png" /><figcaption>The former Ad Scientiam logo.</figcaption></figure><p>I began working at Ad Scientiam two years ago as an intern UI designer. At the time, a large part of the 20~ employees knew that, at some point, we would have to change our logo.</p><p>It hadn’t changed since 2013 and had its flaws : The font did not have a particular personality, the opacity of the logo made it look weird on different backgrounds, and it <strong>didn’t carry an unique message</strong> if you exclude the colors which were chosen to stick to the usual medical field colors.</p><p>Regularly, recent designs were compared to the old logo highlighting the fact that better could be done !</p><p>This difference wasn’t purely aesthetic; the values of the logo didn’t embrace what had become our core values over the years of building the startup.</p><p>As a leader in crafting innovative medical devices for patients, <strong>we couldn’t be mistaken for just another medical company.</strong></p><p>Our logo had to make a difference by embracing and displaying our core values.</p><p>…</p><h3>So what ?</h3><p><em>So what was the tipping point ? What kickstarted the making of a new logo ?</em></p><p>Well … a certain virus that emerged during the year 2020 sent us all home and gave the whole team the opportunity to take a step back and calmly think about the future.</p><p>Of course, it wouldn’t have happened without some <strong>other key elements</strong> :</p><ul><li>Ad Scientiam was growing at a good pace, reaching 50 employees; the danger of being forgotten by partners by adopting a new logo was a minor one.</li><li>Hirings in the UX and UI field helped us better manage and disperse workload between the two teams.</li><li>As a startup, even one with 50~ employees, the managers and the team didn’t lose their agility and creativity, which enabled me to have time to craft &amp; propose ideas.</li></ul><h3>Time to craft a new logo !</h3><p>N<em>ew ? </em>Yes and no. I had had no objective concern leading us to opt for a <strong>complete</strong> rebranding or renaming. Even though Ad Scientiam had solid partnerships and our name was well known in the business, <strong>it had to stay recognizable.</strong></p><p>We had workshops to redefine our values and broke them down into these :</p><ul><li>Ad Scientiam does not just develop products : <strong>it helps patients &amp; healthcare professionals</strong></li></ul><p>Ad Scientiam embarks the patient from the beginning of projects, making sure that our solution can be useful for them; For that, we often partner with patients’ advocacy groups. We also make sure that our solutions can help healthcare professionals with more objective monitoring, giving them data that facilitate the decision-making process.</p><ul><li>Ad Scientiam is not a century-old megafirm with constraints: we are a <strong>young </strong>&amp; <strong>creative </strong>startup.</li></ul><p>When redesigning the logo, this was the main concern that I had. I had to show who we really were. The logo had to breath youth, creativeness. It had to tell how innovative Ad Scientiam aims to be, on the vanguard of how we will heal people tomorrow.</p><ul><li>And most importantly, <strong>we go forward</strong></li></ul><p>The core name of Ad Scientiam describes its ambitions better than anything : it’s Latin for “towards science, towards knowledge”. Visually, it had to display a movement going forward, something that leads to science.</p><h3>The 3 contenders</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*uvjynq-wqO9n7fIk.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*n8AauV_MNvq_W1Ja.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*DuFuss0FzmbwznfT.png" /></figure><p>The first 3 drafts of logos.</p><p>As you can see, these drafts are pretty straightforward visually. What other way of going forward than a leap, multiple jumps, or a road ?</p><p>I gave the old colors a refreshing update, making them bolder.They now represented the typical colors of the medical field (green &amp; blue) but with a touch of freshness and youth.</p><p>Discussions were held to choose one of the 3 drafts and give it some modifications and polishing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7zFQHShynq4_M2Ez273TA.jpeg" /><figcaption>The new Ad Scientiam logo !</figcaption></figure><p>The one that got the love of the jury was the third one because the idea of the road going up and forwards better represented the road “towards science” that we take every day working at Ad Scientiam.</p><p>Ad Scientiam is so proud to embrace this new logo from now on because <strong>it reflects what we are and what we do.</strong></p><p>The road going up and forward forming the “S” of Scientiam, the vibrant colors, the bolder font, the flexible and organic shapes … It all corresponds better to a young company which dares to innovate in the health environment, not stuck by challenges but instead pushed forward by new technologies and upcoming talents.</p><h3>What I learned as a designer</h3><p>The challenging times we all went through these last two years was also an opportunity to better understand and write down why we’re all working for.</p><p>In conclusion, what you must remember from this story is that when the activity slows down a bit, maybe it’s time to wake that idea or project that’s been sleeping in the back of your head for a while.</p><p>Designers and innovators, never be afraid to put your ideas on the table. Give it the polish it deserves and then <strong>push it forward !</strong></p><p><strong>In other words, do something that will make you proud of working where you’re working.</strong></p><p>I personally can’t wait to have this new logo printed everywhere on coffee mugs and posters to replace the old one ;)</p><p><em>The views expressed here are my own and do not reflect the views of Ad Scientiam.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8f6d4bf7526" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ad-scientiam-stories/how-8-years-can-change-a-logo-e8f6d4bf7526">How 8 years can change a logo</a> was originally published in <a href="https://medium.com/ad-scientiam-stories">Ad Scientiam Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a Physical Activity Recommendation Engine?]]></title>
            <link>https://medium.com/ad-scientiam-stories/how-to-build-a-physical-activity-recommendation-engine-39dfed37b311?source=rss----2246370c9a54---4</link>
            <guid isPermaLink="false">https://medium.com/p/39dfed37b311</guid>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[medical-devices]]></category>
            <category><![CDATA[ai-in-healthcare]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Oussama Tchita]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 13:49:15 GMT</pubDate>
            <atom:updated>2022-03-15T13:49:15.729Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_QgOlmMW3J6drr4a" /><figcaption>Photo by <a href="https://unsplash.com/@hocza?utm_source=medium&amp;utm_medium=referral">Jozsef Hocza</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Standing an hour a day keeps the doctor away. This is the conclusion reported in a 2020 <a href="https://academic.oup.com/biomedgerontology/article/76/1/77/5920919?login=true">study</a> by Jain et al, which demonstrated that simply standing for more than an hour a day, without necessarily exercising, is enough to significantly reduce the risk of premature deaths [1].</p><p>According to recent estimates of the World Health Organization, physical inactivity is directly responsible for approximately <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3645500/pdf/nihms385288.pdf">10% of premature deaths worldwide</a>, an impact similar to that of smoking and obesity [2].</p><p>Indeed, this percentage is far too large. <a href="https://pubmed.ncbi.nlm.nih.gov/25599350/">Numerous studies</a> have clearly shown that high levels of physical inactivity are associated with a significant increase in the risk of cardiovascular disease, type 2 diabetes and certain types of cancer [3].</p><p>There is no doubt that prolonged bouts of physical inactivity, such as sitting or lying down for too long, is very bad for health, and it is absolutely necessary to break this bad habit to improve the health of the general population.</p><p>To that end, at <a href="https://www.adscientiam.com/">Ad Scientiam</a> we decided to develop a <a href="https://www.fda.gov/medical-devices/digital-health-center-excellence/software-medical-device-samd#:~:text=The%20term%20Software%20as%20a,Device%20is%20continuing%20to%20increase.">Software as a Medical Device</a> integrating a solution that helps patients with cardiovascular disease after cardiac rehabilitation. But it can also be easily generalized to all kinds of profiles or conditions.</p><p>This solution provides each user with a personalized recommendation system tailored to both their preferences and their health status. Our ultimate goal is to improve patients’ arterial pressure following cardiologist recommendations, which would contribute to a net decrease in relapses.</p><p>Let’s start with a broad introduction of the different components of our Physical Activity Recommendation Engine (PARE).</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*s5FoBGt7IkDqhkMr" /><figcaption>The architecture of the Physical Activity Recommendation Engine (PARE).<strong> <em>Yellow</em>: </strong>the standard input to the system. <strong><em>Red:</em></strong> the engine core components. <strong><em>Green:</em></strong> the information provided by the user.<em> </em><strong><em>Blue:</em></strong><em> </em>the system output.</figcaption></figure><p>A list of physical activities and the patient’s medical information are fed into the PARE, which provides a customized weekly activity program as output. Between these two elements is the engine core, which is in turn composed of three major components:</p><ul><li><strong>The Activity Filtering System (AFS):</strong> it filters out unsafe activities and highlights the most beneficial ones.</li><li><strong>The Activity Ranking System (ARS):</strong> it predicts activity preference scores, and provides a ranking of the activities that are most likely to be selected by the user.</li><li><strong>The Intensity Recommendation System (IRS):</strong> it provides an intensity recommendation associated with each recommended safe activity.</li></ul><p>The recommended activities (with their associated intensities) provided by the engine core are then selected by the user to construct a weekly program. During the week when this program is followed, we collect all kinds of feedback from the user regarding their attitude towards the selected activities and the level of exhaustion after performing them. These different pieces of information will then be used to update and fine-tune the deciding components of our recommendation engine i.e. AFS, ARS and IRS.</p><p>Now that we have a general idea of how it works, let’s break down each component separately.</p><h3><strong>Activity Filtering System</strong></h3><p>The F within AFS stands for filtering i.e. we require an activity list from which we can filter. We have based our work on the updated version of the <a href="https://sites.google.com/site/compendiumofphysicalactivities/home">Compendium of Physical Activities</a> [4]. This compendium provides a comprehensive list of activities, each with its associated intensity and its Metabolic Equivalent of Task (MET). This MET value is a measure of energy expenditure. We’ll circle back to it later on.</p><p>Activities are listed in the Compendium as multiples of the resting MET level, and range from 0.9 (sleeping) to 18 METs (running at 10.9 mph). We have customized this compendium into our own version by selecting only pertinent activities and by reorganizing their intensities. Their pertinence was determined via two factors:</p><ul><li>Their intensity i.e. discarding highly costly activities along with extremely low and inefficient activities. For instance, even though meditating (1 MET) seems gratifying, we will not be recommending that to our users.</li><li>Their nature i.e. a bundle of activities is simply not recommended for our population. For instance, contact sports should be avoided while the patient is under dual antiplatelet therapy (potentially the case for our target population) due to the risk of bleeding, but they may be considered afterwards [5].</li></ul><p>The final list of activities has been thoroughly examined by key opinion leaders who have been involved throughout the process of conception and development of the PARE.</p><p>Here’s a snippet of what the compendium looks like after customization:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e589f10430a3476cb22bbd99d8d46aac/href">https://medium.com/media/e589f10430a3476cb22bbd99d8d46aac/href</a></iframe><p>Once we’ve obtained our custom compendium of activities, we’ll be moving forward with the filtering system. It is based on two essential elements:</p><ul><li>The patient’s cardiorespiratory fitness (CRF).</li><li>The European Society of Cardiology (ESC) recommendations filter for risk level determination.</li></ul><p>The idea behind the AFS is quite basic in its functioning. We define a MET range for recommended activities and only select activities whose MET values fall within the aforementioned range. Easy as it may seem, there are a few intricacies to it.</p><p>First, we ought to define the MET range, which basically represents the recommended range of energy expenditure that is directly linked to cardiorespiratory fitness improvement. This range is naturally patient dependent and the measure that we use to compute it is the VO2max.</p><blockquote>The <a href="https://en.wikipedia.org/wiki/VO2_max">VO2max</a> or maximal oxygen uptake is the maximum rate of oxygen consumption measured during incremental exercise, i.e. exercise of increasing intensity.</blockquote><p>This measure is computed by the patient’s healthcare professional in a controlled setting that looks more or less like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/0*gVvZ5JjAHHq7gen2" /><figcaption>SOLSTOCK/GETTY IMAGES</figcaption></figure><p>Activities requiring a cardiorespiratory fitness higher than that of the patient are not considered for the generation of the program in order to avoid the endangerment of the patient by recommending high effort activities.</p><p>VO2max is thus accepted as the criterion measure of CRF and is converted into a MET to determine the appropriate target activity range.</p><p>Following ESC guidelines along with the patient’s medical information, we establish a MET range inside which all recommended activities must fall into. The filtering procedure then simply selects the activities whose energy expenditures are within the aforementioned MET range.</p><h3><strong>Activity Ranking System</strong></h3><p>The aim of the ARS is to identify the top few activities in a large catalog that have the highest probabilities of being selected by the user. We’ve put in place a hybrid approach that will allow us to iteratively propose activity recommendations to the patient, based on their previous choices, their preferences and their habits. It is a combination of a user-based filtering approach for initial activity recommendation and a content-based approach for updating preferences throughout the use of the application.</p><p><strong>User-based filtering approach</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*Ou--fP5LR0E_Ol-p9apLzw.png" /></figure><p>User-based collaborative filtering is a technique used to predict the items that a user might like, based on the ratings given to those items by other users with similar user-taste.</p><p>This approach, however, requires user-based data beforehand. To that end, Ad Scientiam has conducted an online survey to collect respondents’ physical activity preferences data along with their corresponding profile information (age, gender, living environment etc.). We’ve collected over 700 different responses. Using that data, we’ve trained a recommender model using <a href="https://github.com/jfkirk/tensorrec">TensorRec</a>. This model provides each user with an initialisation of activity preferences based on their profile information. This mapping is further refined using the content-based filtering approach.</p><p><strong>Content-based filtering approach</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*SXIYJhcyttGiAfYWyCXc3A.png" /></figure><p>Content-based filtering projects the recommendation problem into an item space which in our case is the space of all possible physical activities to be recommended by the algorithm. It explores the relationship between physical activities instead of the relationship between users. In most real-life applications, the number of items is dwarfed by the number of users and in many cases, these items are static: the set of items changes much less frequently than the number of users. This allows for a decoupling of the fitting stage and the prediction stage of a content-based collaborative filtering model.</p><p>The concept of similarity is a critical element of the collaborative filtering framework. For user-based collaborative filtering algorithms, the user-similarity matrix consists of a metric that measures the distance between any pair of user preferences. Likewise, the item-similarity matrix measures the similarity between any pair of items in the content-based framework i.e. physical activities.</p><p>Similarity between items such as physical activities may seem abstract, yet we do have multiple means of quantifying it. In our case, we’ve decided to use the <a href="https://en.wikipedia.org/wiki/Cosine_similarity">Cosine similarity</a> measure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*18Q0l0ZuV_ocKgJ_" /></figure><p>This measure relies on the different binary tags associated with each activity found in the main activity list (indoor/outdoor, ball use, water-based, requires gym membership, endurance-based…). Thus, for each activity we obtain a binary vector of tags.</p><p>We’ve specified over 50 binary tags per activity that have been added to our custom compendium of physical activity. This allows us to compute the item-similarity matrix following the aforementioned formula. Below is a dummy data example of how that matrix is represented:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e545bc73a1d8d530a32367a2cd459aa9/href">https://medium.com/media/e545bc73a1d8d530a32367a2cd459aa9/href</a></iframe><p>If we decide to apply the above-mentioned model as is, we might risk a limited exploration of the activity space i.e. a patient may potentially like swimming but they will never know, unless they decide to try out a ‘similar’ activity autonomously.</p><p>In order to prevent this space exploration limitation, we introduce an exploration/exploitation trade-off. It can be defined as the probability from which an activity is selected utterly randomly. This trade-off increases as we go down the ranking of our proposed recommendations.</p><h3><strong>Intensity Recommendation System</strong></h3><p>As stated earlier, the AFS provides a safe activity list for each user. This list is fed to the IRS along with the user’s medical information (VO2max, risk factors, etc.) in order to obtain intensity recommendations for each safe activity. The output translates as follows:</p><ul><li>An amount of activity to be performed during the week.</li><li>An intensity in terms of either effort (light/moderate/vigorous) or target speed (km/h, wattage, etc.) depending on the activity.</li></ul><p>The <a href="https://www.portailvasculaire.fr/sites/default/files/docs/2019_esc_ers_guidelines_ep.pdf">2019 ESC guidelines</a> [6] define a target level of 150–300 minutes of moderate-intensity physical activity per week, regardless of the related MET value in a particular activity. This recommendation can also be considered as 500 to 1000 MET-minutes (MET-min) per week which is obtained by multiplying the time (in minutes) spent performing the activity by the MET value of the activity — based on the 2011 compendium [4].</p><p>Each subject has thus a pre-established weekly amount of activity in METs. This amount will therefore be tweaked weekly depending on the performance of the subject during the previous week. A high outperformance will lead to a slight increase in the activity amount and vice versa. This amount is of course limited on both ends following the ESC guidelines.</p><p>The amount of activity is spread out across the activities selected by the user. The importance of not exceeding the recommended amount of exercise is also highlighted, as over exercising can endanger the subject.</p><h3><strong>Feedback</strong></h3><p>The feedback loop is a vital part of the PARE as it ensures that the three major components (AFS, ARS and IRS) are updated weekly throughout the use of the application. The collected feedback data is either targeted interaction logs with the application or simply straightforward questionnaires.</p><p>Multiple types of information are collected throughout the week; we can divide them up according to their impact vis-à-vis the aforementioned components. Two separate categories of feedback are hereby presented:</p><p><strong>1. Preference-based feedback</strong></p><ul><li>The application collects the information regarding the activities selected by the user for their previous week. This information is concatenated with the list of activities that were actually recommended during said week in order to tweak the activity ranking.</li><li>An activity feedback questionnaire is also given to the user in order to obtain ratings of the performed activities of the week.</li></ul><p>→ The preference-based feedback information updates the activity rankings (ARS) while taking into account not only the previous week’s feedback but also all of the previous ones as well. Their significance decreases as new and updated feedback comes along. Meaning that more recent feedback will have a larger impact on activity rankings than the older one.</p><p><strong>2. Performance-related feedback</strong></p><ul><li>Directly after the conclusion of each activity, we collect the duration of its performance as well as the subject’s exhaustion level within the hour. The exhaustion level is expressed in a <a href="https://en.wikipedia.org/wiki/Rating_of_perceived_exertion">Börg scale</a>. It represents the rate of perceived exertion (RPE). Using this value and the subject’s VO2max, we can recompute the number of METs spent during said activity and correct it in the compendium.</li></ul><p>→ This allows the activity MET values to be even more subject specific in addition to the profile information used in its computation. These new activity METs will directly impact the filtering process in the AFS as well as the intensity recommendation (IRS).</p><h3><strong>Closing thoughts</strong></h3><p>Throughout each step of our proposed model, two fundamental questions regarding physical activity recommendation have been answered:</p><ul><li>Safety: How do we make sure that our recommendations don’t put the user at risk?</li><li>Adherence: How do we make sure that the user sustainably keeps up their physical training program?</li></ul><p>It’s not a mystery to us that physical activity is beneficial. However, we might ignore how beneficial it can be when performed right. It can also have a much larger impact on certain populations.</p><p>Following medical procedures, cardiac patients are often left to their own devices with little or no follow-up when it comes to physical activity training. Our mission here at <a href="https://www.adscientiam.com/fr/">Ad Scientiam</a> is to make a measurable difference for these patients, to adapt to their needs and to provide them with the care they deserve.</p><p>I hope you’ve enjoyed the article. Feel free to share your thoughts and feedback.</p><h3>References</h3><p><strong>[1]</strong> Purva Jain, MPH, John Bellettiere, MPH, PhD, Nicole Glass, MPH, Michael J LaMonte, MPH, PhD, Chongzhi Di, PhD, Robert A Wild, MD, MPH, PhD, Kelly R Evenson, MS, PhD, Andrea Z LaCroix, MPH, PhD, The Relationship of Accelerometer-Assessed Standing Time With and Without Ambulation and Mortality: The WHI OPACH Study, The Journals of Gerontology: Series A, Volume 76, Issue 1, January 2021, Pages 77–84, <a href="https://doi.org/10.1093/gerona/glaa227">https://doi.org/10.1093/gerona/glaa227</a></p><p><strong>[2]</strong> Lee IM, Shiroma EJ, Lobelo F, et al. Effect of physical inactivity on major non-communicable diseases worldwide: an analysis of burden of disease and life expectancy. Lancet. 2012;380(9838):219–229. doi:10.1016/S0140–6736(12)61031–9</p><p><strong>[3]</strong> Biswas A, Oh PI, Faulkner GE, Bajaj RR, Silver MA, Mitchell MS, Alter DA. Sedentary time and its association with risk for disease incidence, mortality, and hospitalization in adults: a systematic review and meta-analysis. Ann Intern Med. 2015 Jan 20;162(2):123–32. doi: 10.7326/M14–1651. Erratum in: Ann Intern Med. 2015 Sep 1;163(5):400. PMID: 25599350.</p><p><strong>[4]</strong> Ainsworth BE, Haskell WL, Herrmann SD, Meckes N, Bassett DR Jr, Tudor-Locke C, Greer JL, Vezina J, Whitt-Glover MC, Leon AS. 2011 Compendium of Physical Activities: a second update of codes and MET values. Med Sci Sports Exerc. 2011 Aug;43(8):1575–81. doi: 10.1249/MSS.0b013e31821ece12. PMID: 21681120.</p><p><strong>[5]</strong> Mats Borjesson, Mikael Dellborg, Josef Niebauer, Andre LaGerche, Christian Schmied, Erik E Solberg, Martin Halle, Emilio Adami, Alessandro Biffi, Francois Carré, Stefano Caselli, Michael Papadakis, Axel Pressler, Hanne Rasmusen, Luis Serratosa, Sanjay Sharma, Frank van Buuren, Antonio Pelliccia, Recommendations for participation in leisure time or competitive sports in athletes-patients with coronary artery disease: a position statement from the Sports Cardiology Section of the European Association of Preventive Cardiology (EAPC), European Heart Journal, Volume 40, Issue 1, 01 January 2019, Pages 13–18, <a href="https://doi.org/10.1093/eurheartj/ehy408">https://doi.org/10.1093/eurheartj/ehy408</a></p><p><strong>[6]</strong> Stavros V Konstantinides, Guy Meyer, Cecilia Becattini, Héctor Bueno, Geert-Jan Geersing, Veli-Pekka Harjola, Menno V Huisman, Marc Humbert, Catriona Sian Jennings, David Jiménez, Nils Kucher, Irene Marthe Lang, Mareike Lankeit, Roberto Lorusso, Lucia Mazzolai, Nicolas Meneveau, Fionnuala Ní Áinle, Paolo Prandoni, Piotr Pruszczyk, Marc Righini, Adam Torbicki, Eric Van Belle, José Luis Zamorano, ESC Scientific Document Group, 2019 ESC Guidelines for the diagnosis and management of acute pulmonary embolism developed in collaboration with the European Respiratory Society (ERS): The Task Force for the diagnosis and management of acute pulmonary embolism of the European Society of Cardiology (ESC), <em>European Heart Journal</em>, Volume 41, Issue 4, 21 January 2020, Pages 543–603, <a href="https://doi.org/10.1093/eurheartj/ehz405">https://doi.org/10.1093/eurheartj/ehz405</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39dfed37b311" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ad-scientiam-stories/how-to-build-a-physical-activity-recommendation-engine-39dfed37b311">How to build a Physical Activity Recommendation Engine?</a> was originally published in <a href="https://medium.com/ad-scientiam-stories">Ad Scientiam Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The science behind the data N°1 — Clock representation of 24-hour cyclic data]]></title>
            <link>https://medium.com/ad-scientiam-stories/clock-representation-of-24-hour-cyclic-data-52d4ec02cb03?source=rss----2246370c9a54---4</link>
            <guid isPermaLink="false">https://medium.com/p/52d4ec02cb03</guid>
            <category><![CDATA[time-series-data]]></category>
            <category><![CDATA[time]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[representation]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Angéline Plaud, PhD in computer science]]></dc:creator>
            <pubDate>Mon, 14 Mar 2022 14:39:33 GMT</pubDate>
            <atom:updated>2022-03-14T14:39:33.828Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wq1n21g_iix8DIVu" /><figcaption>Photo by <a href="https://unsplash.com/@storybyphil?utm_source=medium&amp;utm_medium=referral">Phil Desforges</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Time is by nature cyclical, whether we consider it in seconds, minutes, hours, days, or months. Therefore, choosing the right representation to display time data could be quite challenging. In this article, we will present a time representation that aims to easily spot and explain repetitive patterns, such as sleep parameters. In particular, we will explore in detail the case of daily cyclical data and the use of a clock representation.</p><h3>What are daily cyclical data?</h3><p>Daily cyclical data — or 24-hour time data — are time points going from midnight to almost midnight (note: this precision is important, and will be discussed later). They are often expressed in a <em>HH-MM-SS</em> format (Hours-Minutes-Seconds.). We mainly record those data through daily questionnaires, such as sleeping routine, or eating habits.</p><h3>Choosing the right representation, a.k.a. the Clock</h3><p>When considering daily time data, two representations are possible, either a linear timeline or a circular one.</p><p>However, the cycle representation provides more insights and advantages than the linear one.</p><p>First, it allows to easily flag patterns. As the time measures are plotted and overlap each other, patterns are visually identifiable when present.<em> In our clock figure, we can see that people who sleep after 1 a.m., wake up after 9 a.m.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplotly.com%2F%7Eaplaud%2F1.embed%3Fautosize%3Dtrue&amp;display_name=Plotly&amp;url=https%3A%2F%2Fchart-studio.plotly.com%2F%7Eaplaud%2F1%2F&amp;image=https%3A%2F%2Fchart-studio.plotly.com%2Fstatic%2Fwebapp%2Fimages%2Fplotly-logo.8d56a320dbb8.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=plotly" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7437ae1c17be67d78212707bf8cc77ad/href">https://medium.com/media/7437ae1c17be67d78212707bf8cc77ad/href</a></iframe><p>Then, it prevents a major issue encountered with linear representation, which is the midnight day switch (midnight to almost midnight format) that results in biased distance comparisons (a deeper explanation can be found in the next section).</p><p>Finally, on a daily basis, a clock circle representation is an international standard and looks familiar and easily understandable. Thus, choosing this representation ensures that it is understood by a very large audience.</p><p>Things are getting tricky now, since a preliminary-step is required in order to convert the daily format data into a trigonometric format to achieve a clock representation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26xBI73gWquCBBCDe%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26xBI73gWquCBBCDe%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F26xBI73gWquCBBCDe%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="267" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1bc9ea692dfba28013d63e9f600ed4d/href">https://medium.com/media/d1bc9ea692dfba28013d63e9f600ed4d/href</a></iframe><h3>Why a trigonometric conversion?</h3><p>We decided to opt for a trigonometric data conversion since those data naturally fits into a circle representation, and they can be expressed on a clock. More importantly, this trigonometric conversion triggers the day switch, as explained in the following example.</p><p>First, imagine you want to compute the distance between two different persons&#39; bedtime 🛏. The first indicates a bedtime at “23:59:59” and the second one “00:00:00”. From a data perspective, a day goes from midnight to 23:59:59, so the difference between the bedtime of the two users is 23 hours 59 minutes and 59 seconds, not 1 second as we might think! This doesn’t fit the reality unless we consider the same comparison between the trigonometric values, “23:59:59” becomes cos = 0.9999 and sin = 0.0001 and “00:00:00” becomes cos = 1 and sin = 0. The differences are now minimal and closer to the expectation.</p><p>To complete the trigonometric transformation, those simple few steps can be followed:</p><blockquote>1. Convert time “HH:MM:SS” in seconds.</blockquote><blockquote>2. Divide the obtained time by the total duration of a day in seconds which is 86400.</blockquote><blockquote>3. Multiply it by 2π.</blockquote><blockquote>4. Apply cos and sin to the values.</blockquote><blockquote>5. You’re done !</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FOd0QRnzwRBYmDU3eEO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FOd0QRnzwRBYmDU3eEO%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FOd0QRnzwRBYmDU3eEO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed3d15ed6b790ebc7008f0eec9250ce8/href">https://medium.com/media/ed3d15ed6b790ebc7008f0eec9250ce8/href</a></iframe><p>For more convenience, here is a code snippet in python of the detailed trigonometric transformation.</p><pre>import pandas as pd<br>import math</pre><pre>def extract_time_angle_positions(data: pd.Series) -&gt; pd.Series:<br>    &quot;&quot;&quot; Transform time responses to angles between 0 and 2pi.&quot;&quot;&quot;<br>    return 2 * math.pi / 86_400 * data</pre><pre>def extract_time_positions(data: pd.Series) -&gt; pd.DataFrame:<br>    return pd.DataFrame(<br>        {<br>            &#39;res_cos&#39;: data.apply(math.cos),<br>            &#39;res_sin&#39;: data.apply(math.sin)<br>        }<br>    )</pre><h3>Clock representation, or how to do a nice visualization.</h3><p>Last step will be to draw the clock 🕔 !</p><p>The one in this article has been achieved using plotly library. If you are not familiar with it, <a href="https://plotly.com/">Plotly</a> is a visualization library available for python and R languages, which allows interactive data plotting construction. However, the following steps could be followed in any other programming language.</p><blockquote>1. Draw a circle that will shape the clock of radius 2.</blockquote><blockquote>2. Add the hours from 0 to 24 clockwise along the circle.</blockquote><blockquote>3. Transform current cyclic counterclockwise data into clockwise values.</blockquote><blockquote>4. Shift the data to align midnight with the uppermost point of the circle.</blockquote><p>In our case, we also :</p><blockquote>5. Add a triangular shape, which represents the amount of time spent between two time features of interest, i.e., sleep time and wake-up time.</blockquote><blockquote>6. You’re done again!!</blockquote><p>For more convenience, just after is given a code snippet in python of the detailed clock visualization.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FaLdiZJmmx4OVW%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FaLdiZJmmx4OVW%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FaLdiZJmmx4OVW%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="328" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e3c903297632e4f8c76add17a0548cf/href">https://medium.com/media/3e3c903297632e4f8c76add17a0548cf/href</a></iframe><p>Now you know everything about 24-hour cyclic data representation developed, in our case, for a clinical study regarding depression and sleep disorders.</p><p>Hope you find this article useful, if so leave a comment and see you for another one !</p><pre>import numpy as np<br>import plotly.graph_objects as go</pre><pre>def plot_sleep_analysis(data):<br>    fig = go.Figure()    <br>    sleep_sin = data[&#39;sleep_sin&#39;]<br>    sleep_cos = data[&#39;sleep_cos&#39;]<br>    wakeup_sin = data[&#39;wakeup_sin&#39;]<br>    wakeup_cos = data[&#39;wakeup_cos&#39;]</pre><pre>    # Transform clockwise + shift to midnight data<br>    sleep_angle = np.arctan2(sleep_sin, sleep_cos)<br>    fig.add_trace(<br>        go.Scatter(<br>            x=[-np.cos(sleep_angle + np.pi / 2)],<br>            y=[np.sin(sleep_angle + np.pi / 2)],<br>            mode=&#39;markers&#39;,<br>            marker=dict(size=10),<br>        )<br>    ) <br>   <br>    wakeup_angle = np.arctan2(wakeup_sin, wakeup_cos)<br>    fig.add_trace(<br>        go.Scatter(<br>            x=[-np.cos(wakeup_angle + np.pi / 2)],<br>            y=[np.sin(wakeup_angle + np.pi / 2)],<br>            mode=&#39;markers&#39;,<br>            marker=dict(symbol=&#39;cross&#39;, size=10),<br>            hovertemplate=&#39;cos: %{x} &#39; + &#39; sin: %{y} &#39;,<br>        )<br>    ) </pre><pre>    # Fit the Clock into perfect circle size illustration<br>    fig.update_xaxes(range=[-1.2, 1.2], visible=False)<br>    fig.update_yaxes(range=[-1.2, 1.2], visible=False)<br>    fig.update_layout(<br>        autosize=False,<br>        width=700,<br>        height=600<br>    )</pre><pre>    # Add the 0 to 24 hours around a circle shape<br>    fig.add_shape(<br>        type=&quot;circle&quot;,<br>        x0=-1, y0=-1, x1=1, y1=1,<br>        line_color=&quot;lightgrey&quot;,<br>        opacity=0.4,<br>        layer=&#39;below&#39;<br>    )    <br>    pos = np.linspace(<br>        np.pi / 2, <br>        np.pi / 2 - 2 * np.pi, <br>        24, <br>        endpoint=False<br>    )<br>    for val in range(24):<br>        x_val = np.cos(pos[val])<br>        y_val = np.sin(pos[val])<br>        if abs(y_val) == 1:<br>            x_shift = 0<br>        else:<br>            x_shift = np.sign(x_val) * 10<br>        if abs(x_val) == 1:<br>            y_shift = 0<br>        else:<br>            y_shift = np.sign(y_val) * 10<br>        fig.add_annotation(<br>            x=x_val, <br>            y=y_val, <br>            text=val, <br>            showarrow=False,<br>            xshift=x_shift, <br>            yshift=y_shift<br>        )    <br>    fig.show()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52d4ec02cb03" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ad-scientiam-stories/clock-representation-of-24-hour-cyclic-data-52d4ec02cb03">The science behind the data N°1 — Clock representation of 24-hour cyclic data</a> was originally published in <a href="https://medium.com/ad-scientiam-stories">Ad Scientiam Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>