Monday, April 27, 2009
The Swine Flu Pandemic
Influenza is a viral respiratory disease. According the Center for Disease Control and Prevention (CDC), influenza is “spread from person to person primarily through large-particle respiratory droplet transmission (e.g., when an infected person coughs or sneezes near a susceptible person). Transmission via large-particle droplets requires close contact between source and recipient persons, because droplets do not remain suspended in the air and generally travel only a short distance (1 meter or less) through the air.”[i]
During a typical influenza season, less than 20% of the population becomes ill and the excess mortality cause by influenza is approximately 0.013% of the population[ii]. During the 1918 influenza pandemic, the excess mortality was estimated at 0.65%, fifty-times greater than the normal influenza mortality rate. Pandemics occur when the influenza virus mutates into a strain to which the population has little resistance. During the 20th century there have been three influenza pandemics, most recently in 1968.
The influenza virus tends to be most active in cold, dry climates. CDC data for influenza seasons from 1976-2006 indicates that influenza activity tends to peak during the month of January and February[iii]. Influenza pandemics do not always follow this pattern. Historical evidence shows that influenza pandemics tend to occur in waves and that influenza can be very active during the summer months. “The pandemic of 1918-1919 occurred in three waves. The first wave had occurred when mild influenza erupted in the late spring and summer of 1918. The second wave occurred with an outbreak of severe influenza in the fall of 1918 and the final wave occurred in the spring of 1919.[iv]”
Since pandemic influenza tends to occur in waves, there is an opportunity to limit the impact of future waves. The time between waves may allow for the creation of vaccines. However, egg-based vaccines take approximately six months to create. Nasal spray vaccines can be created in as little as ten weeks, provided there are no production delays[v]. While vaccines may not be prepared in time for future wave, it may be possible to limit the impact of future waves by increasing the supply of medicines and other goods that are in high demand during an influenza pandemic.
[i] CDC Website – “Clinical Signs and Symptoms of Influenza”, Visited on 4/25/08, http://www.cdc.gov/flu/professionals/acip/clinical.htm
[ii] 0.013% is calculated by dividing the 40,000 average deaths by 302,000,000, the current population of the United States.
[iii] http://www.cdc.gov/flu/professionals/acip/clinical.htm#tab1
[iv] Department of Health and Human Services Website – “The Great Pandemic”, Visited on 4/25/08
http://1918.pandemicflu.gov/the_pandemic/01.htm
[v] CDC Website – “2007-2008 Influenza Production and Distribution”, Visited on 4/25/08
http://www2a.cdc.gov/podcasts/media/pdf/PanFluVodcast9-07.pdf
Sunday, April 19, 2009
Thin Clients and Terminal Services
With the advent of the personal computer, people stopped using client-server systems. They no longer need powerful servers, because their desktop computers are capable of running even the most resource-intensive applications.
Unfortunately, this leads to wasted resources. Have you ever taken a look at your CPU utilization rate when you're using a word processor? The typical office worker using a typical office computer might be using 10% of the CPU's capacity and 25% of the RAM's capacity on any given workday.
If the easiest way to stop wasting computer resources is to switch back to a client-server system. Thin-clients are inexpensive terminals that send input from a mouse and keyboard to a server and then show the results on a monitor. The least expensive thin-client cost around $200. These thin-client machines connect to a server on your network, which is where all the applications are run and all the computations occur.
So let me illustrate the benefit of using a thin-client system. If your company had 1,000 writers who all needed a computer with word processing software, you could by 1,000 computers for around $500 each for a total cost of $500,000. Or you could buy 1,000 thin-clients at $200, plus a single server for around $10,000. Total Cost: $210,000
The real benefit of using thin clients is that they are much easier to maintain than a regular computer. Instead of installing software updates on 1,000 computers, you install the update only on the server. Since no software is stored on the thin-client, there's nothing to update, ever!
The other thing I love about thin-clients is that the are quiet; since they don't contain powerful processors or lots of RAM, thin-clients don't need tons of loud, noisy fans.
I've been playing around with the Terminal Services role in Windows Server 2008. Basically, it provides an easy way to allow thin-clients to run programs on the server.
For those of us who are actuaries, there is one other great benefit to using a thin-client system... a $10,000 server will almost certainly run a financial model faster than a $500 desktop computer. This is especially true if you run the model overnight, when other users aren't taxing the system.
Regards,
The Greek Actuary Guy
Friday, April 17, 2009
The Rotting Apple
The Shuffle was great; I think it lasted close to four years before it finally died and I had to buy something new. The iPhone was not so great, but I blame that on the bad AT&T service (I couldn't get decent reception anywhere). However, the iPhone is probably the best text messaging tool available, and when I called up to cancel my contract, AT&T offered me 50 minutes of talk time and 200 text messages for only $25 a month. So I kept the iPhone, even though one speaker is broken and it simply didn't live up to all its hype.
I think the title of this post does a good job describing Apple's current business cycle. When they first came out with the iPhone and iPod, the company was like a blooming apple tree. Apple products became status symbols, every college kid had to have the newest iPod and the latest iPhone. iTunes was also an amazing products; it single-handedly struck a blow to online file sharing and successfully monetized downloadable music.
Today, thanks to the recession, things are much different. The iPhone isn't seen as the latest and greatest cell phone; all the "cool kids" now have Blackberries. IPods are still seen as a way of saying "I have a lot of disposable income", which is exactly what you don't want to say when the country is in the middle of a recession. As for iTunes, it's beginning to face some serious competition, especially from Amazon.com's excellent MP3 service. To be honest with you, I buy all of my music from Amazon, and only use iTunes for the free iTunes university downloads.
I really don't see much of a future for Apple. I loved my old Shuffle, but I decided to buy a Sansa MP3 player instead of another iPod Shuffle. It cost 25% less and it included more features, like a voice recorder and an FM radio. I've been completely happy with Sansa MP3 player, which makes me wonder if I'll ever go back to buying Apple products.
I suspect there are a lot of consumers like me... people who bought Apple products for the status, but are now making their purchases based on price and quality. I'm just not sure if Apple will be able to compete with high quality, low-cost products like the Sansa MP3 player. I suspect Apple's music business is slowly rotting away... But I will say this, new trees only grow from the seeds in a rotten apple. Good Luck Apple.
Wednesday, April 15, 2009
IronPython - An Easy Way to Use CUDA with .NET?
So what should you do if you're a mathematician, who's never coded before in his/her life, and you need to solve very large matrix problems very, very quickly? Learn Python and use the PyCUDA API to solve your problems on the GPU.
"IronPython is an implementation of the Python programming language running on .NET". Basically, it's a way to write Python code that can use all of the .NET framework and other .NET languages. My gut feeling it that you could used IronPython and PyCUDA to expose the computational power of the GPU in an easy to use Microsoft-based tool, like, say Excel...
Anyone try it yet?
Monday, April 13, 2009
Cuda and Visual C++ 2005
I'm running Windows Vista Ultimate 64-bit. I'm using the latest Nvidia drivers, CUDA 2.1 toolkit and the 64-bit SDK.
Here's what I've figured out so far:
1. It need to say x64 in the "Configuration Manager" drop-down box at the top of the screen. That is, you need to tell the compiler that you're using a 64-bit platform.
2. In the solution propeties, under Configuration Properties -> C/C++ -> General, there is a setting called "Additional Include Directories". This needs to point to all the directories that contain CUDA header files. Mine is set to: $(CUDA_INC_PATH);./;../../common/inc
3. The CUDA files, which end in .cu, need to be compiled using a custom build rule that point to the CUDA compiler. This post on the Nvidia forum provides a tool that sets up the custom build rules for you. It worked for me, but use it at your own risk.
After I installed the tool from Step 3, I was able to open a new project, follow steps 1 and 2, copy code from the SDK into the new project, and then it compiled!
Regards,
The Greek Actuary Guy
Saturday, April 11, 2009
Using a C++ DLL in a Microsoft Office VBA Project
On a side note, if you are a young actuary, you really need to read this book on VBA modeling.
When I ran off to graduate school, I began working on very large math problems. Many of these math problems were so complicated that I needed to work on them in a "real" programming language. I began learning C++, one of the most powerful programming languages available.
At some point, I realized it would be cool if I could call C++ code directly from Excel. The reason I want to do this is so I can use CUDA to offload some of my Excel calculations onto the GPUs in my computer. I'll save the details for another post, and use this post to create a C++ DLL (also called a Class Library) and then call a function in that class library from VBA.
So here it is, step by step:
1. Open Visual Studio and create a new C++ Class Library project.
2. Create a header file and an implementation file using the C++ language. If you've never used C++ before, a good book for beginners is Sams Teach Yourself C++.
My header file, named DLL_for_Excel.h, has only one line of code:
int MyNum(void);
My implementation file, DLL_for_Excel.cpp, is also short:
#include "stdafx.h"
#include "DLL_for_Excel.h"
int MyNum(void) { return 123;}
Basically, all this program consists of a function called MyNum that returns the number 123.
3. Since you're building a .DLL file, you also need to create a definition file. This tells the computer what functions are available within the .DLL file. My definition file,DLL_for_Excel.def, has three lines of code:
LIBRARY "DLL_for_Excel"
EXPORTS
MyNum @1
All this is doing is telling the computer that the .DLL file contains a function called MyNum.
4. At this point, you can debug and compile the .DLL file. Copy the .DLL file into a filder where the computer "can see it" (i.e. any folder that is listed in the PATH environmental variable).
5. Now you are ready to use the .DLL file in an Excel VBA project. This is done using the declare function in VBA (it goes at the top of the VBA module). Here is the template for the declare function:
[Public Private] Declare Function name Lib "libname" [Alias "aliasname"] [([arglist])] [As type]
And here is the declare function I used to access the sample .DLL I just created:
Public Declare Function MyNum Lib "DLL_for_Excel.dll" () As Integer
6. The once you have declared the C++ function, you can use it as if it were a VBA functions. Here is an example:
Public Sub mytest()
MsgBox MyNum()
End Sub
These three lines of VBA code will create a message box that shows the number 123.
That's really all there is too using a C++ Function in VBA.
Friday, April 10, 2009
I'm Back...
I opened this blogspot account several years ago, after being pressured to blog by my friends at Saint Cross College, Oxford. I wrote a single one-sentence post and then gave up my career as a blogger.
Being unemployed, I decided to make a serious effort to write this blog. I'm hoping to documents some of the things that occupy my mind. For instance, I will be writing quite a bit about CUDA, a new parallel programming tool from NVidia. CUDA lets you use the processors in your graphics card to perform mathematical operations really, really quickly (like 250x faster than the best CPU). I'll also be writing about speech recognition, or more accurately talking about speech recognition (I'm using the free speech recognition tool in Windows Vista to type all of these blog posts, due to a minor case of carpal tunnel syndrome).
I tend to talk a lot about technology, especially technology that relates to the fields of finance and actuarial science. I'm sort of a cross between an actuary, a statistician, and a database administrator. I'm currently working part time on a masters degree in Data Mining, while also taking the actuarial exams and trying to get my Microsoft certifications.
I've been working on the Netflix Prize competition for the past two years, and I will be using this blogger to document some of my progress. So far there is no progress, mostly because I've been focusing on completely novel ideas, all of which simply haven't worked. Thousands of really smart people have tried every existing Data Mining algorithm, as well as every possible combination of existing Data Mining algorithms. So I feel fairly certain that the only way to win the Netflix Prize is to develop a completely new algorithm.
On a personal note, I've eaten Filet Mignon every day for the past week. I decided to try the no carbs diet again, and thanks to the recession Filet Mignon is less than $5.00 a pound. I bought an 8 pound tenderloin, sliced it into 1 pound chunks, and tossed it in the freezer. There is nothing in the world more succulent than thin-sliced beef tenderloin fried in a garlic butter sauce. My weight was 250 when I started the diet a week ago, and now it's down to 245. I know it's all water weight, but it's encouraging nonetheless.
That's all for now, thanks for reading
The Greek Actuary Guy