Vern  Greenholt

Vern Greenholt

1594622100

COVID-19, Bayes’ theorem and taking probabilistic decisions.

Note from the editors:Towards Data Science_ is a Medium publication primarily based on the study of data science and machine learning. We are not health professionals or epidemiologists, and the opinions of this article should not be interpreted as professional advice. To learn more about the coronavirus pandemic, you can click here._

No test is 100% accurate to detect the novel coronavirus! However, we feel satisfied when we are told that the tests are 98.5% accurate in detecting COVID infections. But what does this accuracy actually mean?

Before we answer this question, let’s review some basic concepts.

  1. True positive: A person with COVID-19 tests positive for COVID-19
  2. False positive: A person without COVID-19 tests positive for COVID-19
  3. False negative: A person with COVID-19 tests negative for COVID-19
  4. True negative: A person without COVID-19 tests negative for COVID-19

Now let’s review what we mean by accuracy, precision, sensitivity and specificity.

Accuracy_ = (true positives + true negatives) / all results_

Precision_ = true positives / (true positives + false positives)_

Sensitivity_ = true positives / (true positives + false negatives)_

Specificity_ = true negatives / (true negatives + false positives)_


Now suppose there are 200 patients. Lets say 100 patients are infected and 100 patients are not. Suppose 99 of the 100 infected patients were tested positive and 2 healthy patients were also tested positive. In other words, 99 people were truly positive, and 2 people were falsely positive. 1 infected person was _falsely negative, and _98 not infected patients were truly negative. Now let’s calculate what we just studied.

Accuracy = (99 + 98) / 200 = 0.985

Precision = 99 / (99 + 2) = 0.98
Sensitivity = 99 / (99 + 1) = 0.99
Specificity = 98 / (98 + 2) = 0.98

Looks good till now, right? Now let’s try to understand more about specificity. It means that out of 100 patients who did not have covid-19, only 98 people tested negative. So, given that a person doesn’t have the virus, probability that he will test negative is 0.98.


Now let’s dive deeper! Probability that given a person who has has covid, tests positive will be given by the conditional probability,

P(+|C⁺) = sensitivity = 0.99.

Similarly, Probability that a healthy patient will test negative will be

P(-|C⁻) = specificity = 0.98.

We got the conditional probabilities, but what use is that? Now let’s say we pick up a random person from a population and test him. He tested positive, but what is the probability that he actually has the novel coronavirus. In other words, here we are interested to find P(C⁺|+).

Now according to Bayes’ theorem,

P(A|B) = P(A)P(B|A) / (P(A)P(B|A) + P(not A)P(B|not A) )

So, if we know P(C⁺), we can easily calculate **P(C⁺|+) **by plugging in the values in the above equation. So, to calculate P(C⁺), you can just just divide the number of cases in your country by the total population. In my case, it is less than 0.0001 which is quite rare. So lets calculate P(C⁺|+).

#bayes-theorem #coronavirus #data-science #probability #data analysis

What is GEEK

Buddha Community

COVID-19, Bayes’ theorem and taking probabilistic decisions.
Osiki  Douglas

Osiki Douglas

1620127560

Data Scientist Creates Python Script To Track Available Slots For Covid Vaccinations

Bhavesh Bhatt, Data Scientist from Fractal Analytics posted that he has created a Python script that checks the available slots for Covid-19 vaccination centres from CoWIN API in India. He has also shared the GitHub link to the script.

The YouTube content creator posted, “Tracking available slots for Covid-19 Vaccination Centers in India on the CoWIN website can be a bit strenuous.” “I have created a Python script which checks the available slots for Covid-19 vaccination centres from CoWIN API in India. I also plan to add features in this script of booking a slot using the API directly,” he added.

We asked Bhatt how did the idea come to fruition, he said, “Registration for Covid vaccines for those above 18 started on 28th of April. When I was going through the CoWIN website – https://www.cowin.gov.in/home, I found it hard to navigate and find empty slots across different pin codes near my residence. On the site itself, I discovered public APIs shared by the government [https://apisetu.gov.in/public/marketplace/api/cowin] so I decided to play around with it and that’s how I came up with the script.”

Talking about the Python script, Bhatt mentioned that he used just 2 simple python libraries to create the Python script, which is datetime and requests. The first part of the code helps the end-user to discover a unique district_id. “Once he has the district_id, he has to input the data range for which he wants to check availability which is where the 2nd part of the script comes in handy,” Bhatt added.

#news #covid centre #covid news #covid news india #covid python #covid tracing #covid tracker #covid vaccine #covid-19 news #data scientist #python #python script

Vern  Greenholt

Vern Greenholt

1594622100

COVID-19, Bayes’ theorem and taking probabilistic decisions.

Note from the editors:Towards Data Science_ is a Medium publication primarily based on the study of data science and machine learning. We are not health professionals or epidemiologists, and the opinions of this article should not be interpreted as professional advice. To learn more about the coronavirus pandemic, you can click here._

No test is 100% accurate to detect the novel coronavirus! However, we feel satisfied when we are told that the tests are 98.5% accurate in detecting COVID infections. But what does this accuracy actually mean?

Before we answer this question, let’s review some basic concepts.

  1. True positive: A person with COVID-19 tests positive for COVID-19
  2. False positive: A person without COVID-19 tests positive for COVID-19
  3. False negative: A person with COVID-19 tests negative for COVID-19
  4. True negative: A person without COVID-19 tests negative for COVID-19

Now let’s review what we mean by accuracy, precision, sensitivity and specificity.

Accuracy_ = (true positives + true negatives) / all results_

Precision_ = true positives / (true positives + false positives)_

Sensitivity_ = true positives / (true positives + false negatives)_

Specificity_ = true negatives / (true negatives + false positives)_


Now suppose there are 200 patients. Lets say 100 patients are infected and 100 patients are not. Suppose 99 of the 100 infected patients were tested positive and 2 healthy patients were also tested positive. In other words, 99 people were truly positive, and 2 people were falsely positive. 1 infected person was _falsely negative, and _98 not infected patients were truly negative. Now let’s calculate what we just studied.

Accuracy = (99 + 98) / 200 = 0.985

Precision = 99 / (99 + 2) = 0.98
Sensitivity = 99 / (99 + 1) = 0.99
Specificity = 98 / (98 + 2) = 0.98

Looks good till now, right? Now let’s try to understand more about specificity. It means that out of 100 patients who did not have covid-19, only 98 people tested negative. So, given that a person doesn’t have the virus, probability that he will test negative is 0.98.


Now let’s dive deeper! Probability that given a person who has has covid, tests positive will be given by the conditional probability,

P(+|C⁺) = sensitivity = 0.99.

Similarly, Probability that a healthy patient will test negative will be

P(-|C⁻) = specificity = 0.98.

We got the conditional probabilities, but what use is that? Now let’s say we pick up a random person from a population and test him. He tested positive, but what is the probability that he actually has the novel coronavirus. In other words, here we are interested to find P(C⁺|+).

Now according to Bayes’ theorem,

P(A|B) = P(A)P(B|A) / (P(A)P(B|A) + P(not A)P(B|not A) )

So, if we know P(C⁺), we can easily calculate **P(C⁺|+) **by plugging in the values in the above equation. So, to calculate P(C⁺), you can just just divide the number of cases in your country by the total population. In my case, it is less than 0.0001 which is quite rare. So lets calculate P(C⁺|+).

#bayes-theorem #coronavirus #data-science #probability #data analysis

Aketch  Rachel

Aketch Rachel

1618099140

How Is TCS Helping With COVID-19 Testing In India

COVID-19 cases have only been on the rise. With the non-availability of effective drugs and vaccines, one of the effective ways to control it is to detect it early in patients. However, the task is easier said than done. While a large number of test kits are being produced, they are not enough to conduct testing in large numbers.

Government-run body, C-CAMP or Centre for Cellular and Molecular Platform, has been a key enabler in driving COVID-19 testing as it has been aggressively building, managing and scaling the ecosystem of MSMEs to produce test kits indigenously. However, they might not be enough.

#opinions #c-camp #c-camp tcs #covid-19 #covid-19 testing #tcs #tcs covid-19

Abigail  Cassin

Abigail Cassin

1596574500

How The New AI Model For Rapid COVID-19 Screening Works?

With the current pandemic spreading like wildfire, the requirement for a faster diagnosis can not be more critical than now. As a matter of fact, the traditional real-time polymerase chain reaction testing (RT-PCR) using the nose and throat swab has not only been termed to have limited sensitivity but also time-consuming for operational reasons. Thus, to expedite the process of COVID-19 diagnosis, researchers from the University of Oxford developed two early-detection AI models leveraging the routine data collected from clinical reports.

In a recent paper, the Oxford researchers revealed the two AI models and highlighted its effectiveness in screening the virus in patients coming for checkups to the hospital — for an emergency checkup or for admitting in the hospital. To validate these real-time prediction models, researchers used primary clinical data, including lab tests of the patients, their vital signs and their blood reports.

Led by a team of doctors — including Dr Andrew Soltan, an NIHR Academic Clinical Fellow at the John Radcliffe Hospital, Professor David Clifton from Oxford’s Institute of Biomedical Engineering, and Professor David Eyre from the Oxford Big Data Institute — the research initiated with developing ML algorithms trained on COVID-19 data and pre-COVID-19 controls to identify the differences. The study has been aimed to determine the level of risk a patient can have to have COVID-19.

#opinions #covid screening #covid-19 news #covid-19 screening test #detecting covid

Anna Yusef

Anna Yusef

1612362000

Charting COVID-19 Data With Python

Charting provides a powerful way to visualize and explore your data by helping to uncover patterns, trends, relationships, and structures that might not be apparent when looking at a table or map. The COVID-19 pandemic has created voluminous streams of data for scientists, researchers, and decision-makers to visualize, analyze, and understand through a variety of data analysis packages and tools.

This blog walks through visualizing characteristics and trends of the COVID-19 pandemic in the United States during 2020 using the integration between Python and ArcGIS Platform.

Preparing the Data

To get started, I’ll load and prepare the data using pandas, but you can use whatever Python tools you prefer. I’m acquiring the data from the New York Times COVID-19 data repository (publicly accessible here), and I’m filtering the data to include only dates from the complete year of 2020.

import pandas as pd
from arcgis.features import GeoAccessor
import arcpy
arcpy.env.workspace = 'memory'

DATA_URL = 'https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv'
# load data with pandas, create new fields, and filter

daily_df = (
    pd.read_csv(DATA_URL, parse_dates=['date'])
        .sort_values(['state', 'date'])
        .rename(columns={
            'cases': 'cases_total',
            'deaths': 'deaths_total'
        })
        .assign(
            cases_new = lambda df: df.groupby('state')['cases_total'].diff().clip(lower=0),
            deaths_new = lambda df: df.groupby('state')['deaths_total'].diff().clip(lower=0)
        )
        .query("'2020-01-01' <= date <= '2020-12-31'")
        .reset_index(drop=True)
)

Here’s a quick look at the prepared dataset. Notice that there is an individual row for each date and state combination. These rows will be summarized and aggregated when I visualize this data with charts.

#python #covid-19 #covid 19 #charting