<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-15125061</id><updated>2012-01-16T23:34:05.813-06:00</updated><category term='introduction'/><category term='pattern recognition'/><category term='svm'/><title type='text'>Jason Knight</title><subtitle type='html'>A personal homepage.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-15125061.post-6894859864234986076</id><published>2011-06-24T17:03:00.000-05:00</published><updated>2011-06-24T17:03:57.069-05:00</updated><title type='text'>What does our DNA look like?</title><content type='html'>Everyone has seen the DNA double helix (if not&lt;a href="http://en.wikipedia.org/wiki/DNA"&gt; click here right now&lt;/a&gt;), but what does your DNA look like as an image?&lt;br /&gt;&lt;br /&gt;Specifically, I was daydreaming today when I thought: what if someone took one of the sequenced human genomes out there and converted all the letters into corresponding colors for the pixels of an image?&lt;br /&gt;&lt;br /&gt;I decided that that someone was going to be me!&lt;br /&gt;&lt;br /&gt;And a few minutes later with somewhere north of 25 google searches (where do I download the human genome? How do I remove newlines and capitalize letters with awk? How can I write PNGs with Haskell? What color code is a 32bit RGBA PNG in its header? etc...) I had my answer:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-V_3Gj0y8kA0/TgUHrXfv-kI/AAAAAAAAAlw/435g5na3XtU/s1600/testimg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="319" src="http://3.bp.blogspot.com/-V_3Gj0y8kA0/TgUHrXfv-kI/AAAAAAAAAlw/435g5na3XtU/s320/testimg.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Now, a few caveats: This is only a portion of the Y chromosome of the &lt;a href="http://hgdownload.cse.ucsc.edu/downloads.html#human"&gt;19th human sequenced&lt;/a&gt;. It really doesn't look like much does it? But it was a fun exercise for the 30 minutes or so before I headed home for the weekend.&lt;br /&gt;&lt;br /&gt;The code (almost all of which came from &lt;a href="http://www.haskell.org/haskellwiki/Library/PNG"&gt;this PNG example&lt;/a&gt;) can be &lt;a href="http://hpaste.org/48283"&gt;found here&lt;/a&gt;. It is very ugly and does not use Haskell as it was meant to be used. But it gets the job done!&lt;br /&gt;&lt;br /&gt;Please let me know if you have any suggestions as to making the image prettier/more informative. Perhaps I should indicate the location of TATA boxes or Poly-A tails etc... Maybe I'll find some time to do it too!&lt;br /&gt;&lt;br /&gt;Just imagine that most of that is inside of us (the guys anyways, sorry ladies!), inside of every cell in our bodies in fact. Kinda neat if you ask me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15125061-6894859864234986076?l=blog.jasonknight.us' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/6894859864234986076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.jasonknight.us/2011/06/what-does-our-dna-look-like.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/6894859864234986076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/6894859864234986076'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/2011/06/what-does-our-dna-look-like.html' title='What does our DNA look like?'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-V_3Gj0y8kA0/TgUHrXfv-kI/AAAAAAAAAlw/435g5na3XtU/s72-c/testimg.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15125061.post-3213050028823037098</id><published>2010-12-16T23:17:00.000-06:00</published><updated>2010-12-16T23:17:15.685-06:00</updated><title type='text'>Our New ChromeOS Notebook - First Impressions</title><content type='html'>Well, it is getting 'late' here, so I must keep this short, but to see pictures of what the CR-48 laptop looks like, I would highly recommend the below reviews I found. They also go into more depth of all the features and everything. But I will leave you with some quick first impressions.&lt;br /&gt;&lt;br /&gt;It has occurred to me that this computer is *perfect* for people like Emily. It basically strips out all the unnecessary cruft of the OS that has been accumulating for decades, and puts you right onto the internet as quick as possible. The simplicity of this experience is very refreshing, and it takes some getting used to, but after browsing the Chrome App Store for a bit, and playing some games with Emily there, I realized how ready we are for this transition-to-the-cloud to occur.&lt;br /&gt;&lt;br /&gt;The hardware is really great (you'll read opposite opinions elsewhere), and it really is the perfect 12" form factor that is slim and light enough to carry around with you, but big enough that you don't feel cramped while typing or browsing. The sleep-wake behavior is beautiful, it sleeps and wakes so effortlessly that you wonder why this has never been perfected before (except on a few Macbooks that I've seen people around me use).&lt;br /&gt;&lt;br /&gt;It is a little slow, but because the browser is basically running on the metal, you don't really notice it except on occasion. Although I have not tried youtube, the html5 video player on vimeo seemed to work just fine for me.&lt;br /&gt;&lt;br /&gt;One really promising feature is when you alt+tab to different browser windows, the effect is obviously hardware accelerated and liquid smooth, which makes me pine for the days when Chrome gets hardware accelerated rendering (as then all scrolling should theoretically be that smooth).&lt;br /&gt;&lt;br /&gt;So Emily and I are going to share the cr48 (although we need to come up with a cuter name for it), as I think it is an even better fit for her than it is for me (I've found that you can Ctrl+Alt+T to open a limited shell that I can ssh from, but that's kinda besides the point of a notebook like this).&lt;br /&gt;&lt;br /&gt;I'm excited to try the battery life out some, and see how the free 3G performance is from Verizon.&lt;br /&gt;&lt;br /&gt;Here's those reviews:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.thesearethedroids.com/2010/12/16/google-cr-48-review/"&gt;http://www.thesearethedroids.com/2010/12/16/google-cr-48-review/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://techcrunch.com/2010/12/12/cr-48-chrome-notebook-review/"&gt;http://techcrunch.com/2010/12/12/cr-48-chrome-notebook-review/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://gizmodo.com/5710532/an-hour-with-the-google-cr+48-chrome-netbook"&gt;http://gizmodo.com/5710532/an-hour-with-the-google-cr+48-chrome-netbook&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ejohn.org/blog/google-cr-48-for-coding/"&gt;http://ejohn.org/blog/google-cr-48-for-coding/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15125061-3213050028823037098?l=blog.jasonknight.us' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/3213050028823037098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.jasonknight.us/2010/12/our-new-chromeos-notebook-first.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/3213050028823037098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/3213050028823037098'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/2010/12/our-new-chromeos-notebook-first.html' title='Our New ChromeOS Notebook - First Impressions'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15125061.post-1347816994073497989</id><published>2010-04-04T21:48:00.000-05:00</published><updated>2010-04-04T21:48:12.476-05:00</updated><title type='text'>Optimizing Python + Numpy Code</title><content type='html'>So I decided to learn Cython, and in doing so, I found an interesting post&lt;a href="http://timwang.posterous.com/matlab-faster-than-python-numpy"&gt; comparing Matlab speed to Numpy + Python and Numpy + Cython&lt;/a&gt;. Obviously I was intrigued, and with the available code, pasted into vim I was off and running!&lt;br /&gt;&lt;br /&gt;The first thing to do is the first step in ALL optimization workflows: profiling! Using the wonderful cProfile.run('GMMGaussianMC(100000)','prof.dat') we can glean the following: &lt;a href="http://pastebin.com/hdStTWnH"&gt;(output pasted here for readability).&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Hmmm.. 32 seconds (out of 60) in numpy.linalg.solve&lt;/li&gt;&lt;li&gt;Only 10 seconds is spent 'in'&amp;nbsp;GMMGaussian (and 3 in GMMGaussianMC), so the bulk is in Numpy&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;This explains why Tim's Cython conversion did not net any gain (it's all numpy bound). Thus while chewing on the numpy problem, I started implementing some simple (but in retrospect, probably minor) common python + numpy optimizations: vectorizing code by pulling it out of the inner for loop. And inlining the function call (I'd be curious to see how much this helped, as it is a rather ugly change in general).&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This took us down from 30 seconds to about 22 seconds, not bad, but not great either.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, for the linear algebra. It appears that a great deal of our time is spent in the numpy.linalg.solve function, why is this? And after a bit of searching I found &lt;a href="http://mail.scipy.org/pipermail/scipy-user/2009-January/019323.html"&gt;this insightful mailing list post&lt;/a&gt; (see towards the bottom). It appears that MATLAB does a lot of heuristics in order to use the most efficient way of solving a linear system, whereas numpy takes the easy out approach by calling the generic LAPACK solver (DGESV for anyone interested). After rejecting the idea of compiling a faster LAPACK because it would require rebuilding Numpy, I decided to look more closely at the linear algebra at use in the code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sure enough, I found that we were dealing with purely diagonal matrices which makes the prospect of simply inverting and multiplying possible.&lt;b&gt; BAM!!! This takes us down to &lt;u&gt;8 seconds,&lt;/u&gt; which is comparable to the MATLAB script&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://profiling%20now/"&gt;Profiling now&lt;/a&gt; we can see that everything is either in the GMMGaussianMC function, or quick numpy functions like randn, dot, inner, etc... There is not much we can do about this to my knowledge, so we are now done!&lt;a href="http://pastebin.com/FLB43tT6"&gt; (link to final code)&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now time to go learn about the theory behind this algorithm...&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S. Sorry about the poor writing quality in this post, I'm trying to talk and write at the same time, and the result is a poor mess of both :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15125061-1347816994073497989?l=blog.jasonknight.us' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/1347816994073497989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.jasonknight.us/2010/04/optimizing-python-numpy-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/1347816994073497989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/1347816994073497989'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/2010/04/optimizing-python-numpy-code.html' title='Optimizing Python + Numpy Code'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15125061.post-3986360952574152987</id><published>2010-04-02T00:05:00.000-05:00</published><updated>2010-04-02T00:05:27.844-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='introduction'/><category scheme='http://www.blogger.com/atom/ns#' term='pattern recognition'/><category scheme='http://www.blogger.com/atom/ns#' term='svm'/><title type='text'>Support Vector Machines - An Introduction</title><content type='html'>This one goes out to Bryan to explain what a support vector machine is, but first I must cover a little bit of background information first.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Pattern Recognition&lt;/span&gt;&lt;br /&gt;Let's say that we are a farmer trying to decide if our crops are going to be healthy this season, or ridden with locusts. We know that the chance of locust infection is heavily dependent on a lot of factors such as the length of the winter, the previous harvest size, and the last season's locust amounts. Ideally we would like to feed this data, the 'feature vector', into a black box that would output an accurate prediction for the presence or absence of locusts this year.&lt;br /&gt;&lt;br /&gt;Being a mathematically trained farmer, we would know that there exists toolsets to do just that, so we would root around in our filing cabinets pulling up data of locust infections from years past and the corresponding weather patterns and harvests to makeup a training data set.&lt;br /&gt;&lt;br /&gt;Now for a bit of definitions, a&amp;nbsp;classification rule is a mathematical function that takes a set of training data and produces a classifier. A classifier is a function that maps a single feature vector, or sample point, to a label. These labels can be yes/no, locust/no locust, healthy/unhealthy, or even consist of multiple classes.&lt;br /&gt;&lt;br /&gt;As a farmer, we will take our training data, use a classification rule in order to produce a classifier, and then input this year's parameters into the classifier in order to obtain a prediction for this years locust population. &lt;br /&gt;&lt;br /&gt;Now, a small aside, why do we even bother with this in the first place? Usually the need to automate this process of prediction comes down to speed and complexity. For instance, in a factory where we want to separate tuna from&amp;nbsp;sea bass we&amp;nbsp;may want to classify several hundred fish per second. Or more often the case, the predictions are done in such highly complex scenarios that humans cannot easily handle them intuitively (can you visualize hundred dimensional spaces?).&lt;br /&gt;&lt;br /&gt;Which classification rule (thus classifier) we use is a complicated issue, but today we'll talk about support vector machines (SVMs).&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Support Vector Machines&lt;/span&gt;&lt;br /&gt;The essence of SVMs is simple, take the training data, and divide the data into two (for a two class classifier) using a straight line. Or in three dimensions, use a plane, and anything higher, use a hyper plane. The math works out the same, but it is easier to visualize in the 2D line case.&lt;br /&gt;&lt;br /&gt;How do we determine where to draw the line? Simply pick the line that creates the largest gap (or margin) between the closest set of opposing points. This can be formalized into an optimization problem, which I won't get into how to solve here, and the resulting hyperplane is used as our classifier. To do so, we simply take the current data point (this year's data) and see if it is on the locust or non-locust side of the (hyper)plane. See the image to the right (credit to Wikimedia) for a nice visual.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/2/2a/Svm_max_sep_hyperplane_with_margin.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="320" src="http://upload.wikimedia.org/wikipedia/commons/2/2a/Svm_max_sep_hyperplane_with_margin.png" width="296" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now what if the data overlaps? Then we have to move to nonlinear kernel based SVMs where we map our 'low' dimensional data into a higher dimensional space using a fancy kernel function and try to separate it there.&lt;br /&gt;&lt;br /&gt;There are many technicalities and finer points here, but that is the essence of what SVM does.&lt;br /&gt;&lt;br /&gt;Note to Bryan, Kevin, and Hope: Now, for hyperspectral imaging, each pixel of a hyperspectral image &amp;nbsp;contains hundreds of values, one for each frequency band, and these are usually taken far enough away from the object of interest, that each pixel represents the combination of several signatures (or endmembers). Thus, an image might be 5 meter resolution and contain the signature for both soil and corn crop, and we wish to extract each of those endmembers from the several hundred values in the pixel. Using SVM to accomplish this leads to SVM endmember extraction. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15125061-3986360952574152987?l=blog.jasonknight.us' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/3986360952574152987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.jasonknight.us/2010/04/support-vector-machines-introduction.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/3986360952574152987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/3986360952574152987'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/2010/04/support-vector-machines-introduction.html' title='Support Vector Machines - An Introduction'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15125061.post-5959711226785307457</id><published>2010-03-31T19:13:00.000-05:00</published><updated>2010-03-31T19:13:26.438-05:00</updated><title type='text'>Welcome!</title><content type='html'>After Esmaeil showed me how blogger had changed over the years, I decided to implement my personal page here and see how it goes. Let's see if I can stick to updating this thing and making it work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15125061-5959711226785307457?l=blog.jasonknight.us' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.jasonknight.us/feeds/5959711226785307457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.jasonknight.us/2010/03/welcome.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/5959711226785307457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15125061/posts/default/5959711226785307457'/><link rel='alternate' type='text/html' href='http://blog.jasonknight.us/2010/03/welcome.html' title='Welcome!'/><author><name>Jason Knight</name><uri>https://profiles.google.com/102340116383554399495</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-7hdboMymj1U/AAAAAAAAAAI/AAAAAAAABMk/_GLjUsAnHms/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry></feed>
