Posts

Another Neural Net Regression

Image
 If you search the web for neural net regression, you will find a number of examples. Most begin by generating some data from  a linear or sinusoidal function and adding a bit of noise. They then fit the resulting data with a neural net created with a tool such as PyTorch .  In this post, I want to try to accomplish two things: learn a bit about neural nets and explore PyTorch. Neural nets are often discussed in relation to deep learning . Deep learning typically involves large amounts of data and multiple network layers with complex architectures that are used in areas such as computer vision or speech recognition. The example we are considering isn't particularly deep, but I hope it illustrates a a few simple principles of neural nets. PyTorch is a Python machine learning toolkit developed by Facebook. Its main features are tensor computing and automatic numerical differentiation. Rather than using generated data, I want to use real data and see what happens as I u...

Breakthroughs Again

Image
This post is an update to a previous post . The CDC extended the database of breakthrough cases and deaths so that it now extends from 2021_04_04 to 2021_12_12. In addition, CDC altered the format of the MMWR.week column. MMWR.week is an epidemiological date format that can be used to produce dates in R's date format. Updated code is available on GitHub . Since it now includes the beginning of the omicron phase of the pandemic, I thought it might be time to take another look. I downloaded the breakthrough data from the CDC on 2022-02-04.  First, cases and deaths for vaccinated patients vs. non-vaccinated patients. Compare these with the  previous plots . Notice the increase in cases in the later months of the plot. Fortunately, the increase in deaths is not so dramatic. Presumably, this is because it seems that omicron, more transmissible but seemingly less virulent, is replacing the delta strain in the population. Also, notice that being vaccinated provides protection agains...

BA.1 and BA.2

Image
 BA.2 is a sub-variant of the omicron variant of SARS-Cov-2. It has basically the same collection of mutations as BA.1, the original omicron variant with about 28 others. It was first identified in South Africa on 2021-11-17. BA.2 is more transmissible than BA.1. On 2022-01-30, I downloaded 7,623,097 records for SAR-CoV-2 sequences from GISAID . I plotted the the development of the variants of interest (VOI) and variants of concern (VOC) over time with  plot_named_variants.R available on GitHub . This messy plot show the growth of omicron (the green dots on the right) as it overtakes delta (the gold dots at the top right). The plot shows log counts of sequences in the GISAID database. Assuming GISAID data is a representative sample of COVID-19 cases, at least in developed countries, the straight line increase indicates that omicron is under going exponential grown. We can compare the growth of BA-1 and BA-2. BA_1_2 <- meta_2022_01_30 %>% filter(Pango.lineage...

Breakthroughs

Image
Vaccines, masks, and social distancing provide protection against COVID-91. The protection isn't prefect however. Even being fully vaccinated  doesn't guarantee that you won't get sick. It does  significantly reduce your chances of being seriously ill, i.e. hospitalized or dead. The CDC provides a dashboard where you can visualize cases and hospitalizations. If you're like me, you want to get the raw data and see for yourself. The CDC provides data on cases and vaccinations in a variety of formats at  https://data.cdc.gov/Public-Health-Surveillance/Rates-of-COVID-19-Cases-or-Deaths-by-Age-Group-and/3rge-nu2a and  https://data.cdc.gov/Public-Health-Surveillance/Rates-of-COVID-19-Cases-or-Deaths-by-Age-Group-and/d6p8-wqjm . On January 5 2022, I downloaded a data file with 630 observations of case and death summaries from COVID-19 from the first site above.  Here's what the data looks like after it has been loaded into R. > head(vac_status) outcome mont...

Omicron and Delta

Image
The omicron variant of concern (VOC) has been circulating world wide for about two months. I thought it would be interesting to look at its growth rate compared to the currently predominate delta strain.  On December 29 2021, I downloaded metadata for 6,553,878 sequences from GISAID . A question arises about whether GISAID sequence data is a representative sample of the world COVID-19 situation.  Here are the top ten countries submitting sequences: Country Count USA 2077490 United Kingdom 1586855 Germany 309670 Denmark 278104 Canada 230413 Japan 185716 France 174125 Sweden 138151 Switzerland 102008 India 99823 temp <- meta_data %>% select(Location) %>% separate(Location, c( "Region" , "Country...

I Really Want to Like Julia...

Image
  I really do. I want to like Julia . There is much to like: a great REPL , multiple dispatch ; concurrent, parallel, and distributed computing;  direct calling of C and Fortran libraries; dynamic type system; nice package manager; macros, etc. There are problems with Julia that may be showstoppers for me. My usual workflow with Python, R, Java, or C++ is to write code in small pieces and incrementally test, building the program one routine at a time. For example, I typically write the input routine, test; write the data processing steps, one step at a time and test; write plotting routines and test. Test the whole program and fix any problems. I really should write the tests first like I tell students, but sometimes I cheat.  The process described above is common. Julia makes approaching programming in that manner frustrating. The source of the frustration is compile time latency . Julia's  JIT compiler results in great execution speeds, but you pay a price each ti...

Kalman Filter and Change Points, Part 3

Image
The first step toward change is awareness. The second step is acceptance.  ~ Nathaniel Branden There is nothing permanent except change. ~ Heraclitus I previously looked at the problem of segmenting a time series. Segmenting involves discovering points in the series where there is change. One question arises immediately; when what changes?  In a previous post , we tried to segment the series based on changes to the parameters of a probability distribution or on discovering outliers in the trend discovered by a Kalman filter. Bayesian Change Point Again Here's the data from the previous post. This is  temperature anomaly  data from the   NASA Global Climate Change  site. We could think of this data as a series of linear segments. Each segment has a mean. The data in each segment is scattered around the linear line segments. Within each segment, we assume the mean is constant. The mean is described by an intercept and slope. The data points are scatt...