<?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/'><id>tag:blogger.com,1999:blog-12983281.post2247153525085221912..comments</id><updated>2007-10-15T02:39:49.877-07:00</updated><title type='text'>Comments on I Need Closure(s): Programming Collective Intelligence - Viewing Data...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://i-need-closures.blogspot.com/feeds/2247153525085221912/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default'/><link rel='alternate' type='text/html' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html'/><author><name>Richard Cook</name><uri>http://www.blogger.com/profile/11838741004941594394</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12983281.post-3609691174070914003</id><published>2007-10-15T02:39:00.000-07:00</published><updated>2007-10-15T02:39:00.000-07:00</updated><title type='text'>Sorry about being terse about the locality.What I ...</title><content type='html'>Sorry about being terse about the locality.&lt;BR/&gt;&lt;BR/&gt;What I meant is that you loop over all n times n elements to calculate the fakedist.  And then you go over the same list again to calculate the error.  fakedist[i, j] is accessed only when calculating error[i,j].  So why not calculate the value within the loop where it is needed.  I see three advantages:&lt;BR/&gt;&lt;BR/&gt;a) the code is clearer -- it is obvious that the fakedist is only needed there&lt;BR/&gt;&lt;BR/&gt;b) memory access locality is more local, i.e. you only iterate once -- if you have a lot of data, you have half the cache misses, and also values from loc might still be in registers giving the compiler more chances at optimising the calculations&lt;BR/&gt;&lt;BR/&gt;c) doing all the calculations for an element in one place makes it easier to parallelise the calculation.  I had hoped to work on this this weekend but spent exactly 0 seconds on the computer thanks to familiy activities.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/3609691174070914003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/3609691174070914003'/><link rel='alternate' type='text/html' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html?showComment=1192441140000#c3609691174070914003' title=''/><author><name>H Durer</name><uri>http://www.blogger.com/profile/00555282306926644834</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html' ref='tag:blogger.com,1999:blog-12983281.post-2247153525085221912' source='http://www.blogger.com/feeds/12983281/posts/default/2247153525085221912' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12983281.post-3524272050732451366</id><published>2007-10-14T19:11:00.000-07:00</published><updated>2007-10-14T19:11:00.000-07:00</updated><title type='text'>You are correct about the setf vs. incf. Thanks.I'...</title><content type='html'>You are correct about the setf vs. incf. Thanks.&lt;BR/&gt;&lt;BR/&gt;I'm not sure what you mean about the locality of fakedist. All the values of fakedist (except where (eq k j)) are used in the &lt;BR/&gt;(dotimes (k n) &lt;BR/&gt;  (dotimes (j n &lt;BR/&gt;loop.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/3524272050732451366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/3524272050732451366'/><link rel='alternate' type='text/html' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html?showComment=1192414260000#c3524272050732451366' title=''/><author><name>Richard Cook</name><uri>http://www.blogger.com/profile/11838741004941594394</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14118512511685171087'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html' ref='tag:blogger.com,1999:blog-12983281.post-2247153525085221912' source='http://www.blogger.com/feeds/12983281/posts/default/2247153525085221912' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12983281.post-6249094175457565282</id><published>2007-10-12T11:41:00.000-07:00</published><updated>2007-10-12T11:41:00.000-07:00</updated><title type='text'>Cool Lisp trick of the day for ya: #'(lambda (x) x...</title><content type='html'>Cool Lisp trick of the day for ya: #'(lambda (x) x) is #'identity.  But in this case, it looks like you're just using it to convert a list into a vector, so #'vector would be even simpler: (apply #'vector ...)&lt;BR/&gt;&lt;BR/&gt;:-)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/6249094175457565282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/6249094175457565282'/><link rel='alternate' type='text/html' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html?showComment=1192214460000#c6249094175457565282' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html' ref='tag:blogger.com,1999:blog-12983281.post-2247153525085221912' source='http://www.blogger.com/feeds/12983281/posts/default/2247153525085221912' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12983281.post-5394752311278235034</id><published>2007-10-11T13:05:00.000-07:00</published><updated>2007-10-11T13:05:00.000-07:00</updated><title type='text'>Thanks for the new instalment.A few comments:The l...</title><content type='html'>Thanks for the new instalment.&lt;BR/&gt;&lt;BR/&gt;A few comments:&lt;BR/&gt;&lt;BR/&gt;The line after "; Move points in proportion to error" seems wrong.  Should be incf not setf, otherwise you'll only consider the last element for moving in x-direction.&lt;BR/&gt;&lt;BR/&gt;Isn't it quite wasteful to always allocate a new grad array?  Just resetting it to 0 in each round would be enough and not cons quite so much.  (I was thinking of fill but that only works on plain sequences, so one would have to recast it to one "(fill (make-array (* n 2) :displaced-to grad) 0.0))" -- not the prettiest solution maybe)&lt;BR/&gt;&lt;BR/&gt;Not sure how much data you have, but the locality of access isn't as good as good be.  E.g. why calculate the whole of fakedist beforehand if you only always need one element which you could calculate then, when  needed?&lt;BR/&gt;&lt;BR/&gt;And another thing I was wondering (I don't have the book yet -- we have a postal strike here -- so maybe this is explained in the book): How do you guarantee that the elements of loc remain in the range [0;1]?  If they drift outside your display routine will draw a few items outside the page, or not?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/5394752311278235034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12983281/2247153525085221912/comments/default/5394752311278235034'/><link rel='alternate' type='text/html' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html?showComment=1192133100000#c5394752311278235034' title=''/><author><name>Holger Durer</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://i-need-closures.blogspot.com/2007/10/programming-collective-intelligence.html' ref='tag:blogger.com,1999:blog-12983281.post-2247153525085221912' source='http://www.blogger.com/feeds/12983281/posts/default/2247153525085221912' type='text/html'/></entry></feed>