<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Some stuff &#187; structure</title>
	<atom:link href="http://blog.yhuang.org/?feed=rss2&#038;tag=structure" rel="self" type="application/rss+xml" />
	<link>https://blog.yhuang.org</link>
	<description>here.</description>
	<lastBuildDate>Wed, 27 Aug 2025 08:50:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>data structure problem</title>
		<link>https://blog.yhuang.org/?p=854</link>
		<comments>https://blog.yhuang.org/?p=854#comments</comments>
		<pubDate>Fri, 09 Mar 2012 04:50:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[entropy]]></category>
		<category><![CDATA[fraction]]></category>
		<category><![CDATA[mathbb]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=854</guid>
		<description><![CDATA[Another problem by fakalin. A data structure has the entropy bound if all queries have amortized time , where is the fraction of the time that key is queried. It has the working-set property if the time to search for an element is , where is the number of elements queried since the last access [...]]]></description>
			<content:encoded><![CDATA[<p>Another problem by fakalin.</p>
<blockquote><p>A data structure has the entropy bound if all queries have amortized time \(O(\sum_k p_k \log 1/p_k)\), where \(p_k\) is the fraction of the time that key \(k\) is queried. It has the working-set property if the time to search for an element \(x_i\) is \(O(\log t_i)\), where \(t_i\) is the number of elements queried since the last access to \(x_i\). Prove that the working-set property implies the entropy bound.</p></blockquote>
<p>This isn&#8217;t really a data structure problem, per se.<br />
<span id="more-854"></span><br />
The general intuition here is that, if the waiting time between two queries to a key \(k\) is \(t(k)\), then key \(k\) ends up taking up about a \(p_k = 1/t(k)\) fraction of the queries, and therefore the average query time is about \(\sum_{k\in K} 1/t(k) (\log t(k))\).</p>
<p>While this is exactly true for evenly spaced-out queries, the general case only requires a slight modification using any of the rudimentary convex inequalities such as:</p>
<p><strong>Jensen&#8217;s inequality:</strong> If \(f\) is a convex function and \(X\) is a random variable, then \(\mathbb{E}f(X)\ge f(\mathbb{E}X)\).</p>
<p>(The proof just uses the definition of what a convex function is. Furthermore, if we recognize that \(-\log x\) is a convex function, then we get \(\mathbb{E}\log(X)\le \log(\mathbb{E}X)\), which restates the well-known fact that the geometric mean is less than or equal to the arithmetic mean of a collection of real numbers.)</p>
<p>Now, let \(N\) be the total number of queries. Let \(n(k)\) be the number of queries on key \(k\). Let \(t_i(k)\) be the time between the \(i\)th query on key \(k\) and the previous query on the same key. Let \(\bar{a}(k)< C \sum_{i=1}^{n(k)} \log t_i(k) / n(k)\) (for some \(C>0\)) be the <em>average</em> query time looking up key \(k\), as guaranteed by the working-set property (*). Let \(\bar{t}(k) = \sum_{i=1}^{n(k)} t_i(k) / n(k)\) be the <em>average</em> time between queries for key \(k\).</p>
<p>Note that we must have \(\bar{t}(k) \le N/n(k)\). Furthermore, \(p_k = n(k)/N\) by definition, hence \(\bar{t}(k) \le 1/p_k\) (**). The average query time over all keys is therefore:</p>
<p>\(\sum_k \bar{a}(k) n(k) / N\)<br />
\(< \sum_k [C \sum_{i=1}^{n(k)} \log t_i(k) / n(k)] [n(k) / N]\), by (*)<br />
\(\le C \sum_k [\log \sum_{i=1}^{n(k)} t_i(k) / n(k)] [n(k) / N]\), by Jensen&#8217;s inequality<br />
\(= C \sum_k [\log \bar{t}(k)] p_k\)<br />
\(\le C \sum_k p_k \log 1/p_k\), by (**)</p>
<p>∎</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=854</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>google wave lacks structure</title>
		<link>https://blog.yhuang.org/?p=226</link>
		<comments>https://blog.yhuang.org/?p=226#comments</comments>
		<pubDate>Tue, 01 Dec 2009 22:03:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[conversation mode]]></category>
		<category><![CDATA[endeavor]]></category>
		<category><![CDATA[linear structure]]></category>
		<category><![CDATA[metaphor]]></category>
		<category><![CDATA[playback]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[today]]></category>
		<category><![CDATA[topic]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=226</guid>
		<description><![CDATA[Got an invitation to Google Wave today. The problem I find immediately is the lack of structure. Say what you will about the restrictions of email or IM, but the same restrictions of those ways of communication, namely time-flow or thread-flow, are also well enforced structures to keep things sane. Wave takes away these and [...]]]></description>
			<content:encoded><![CDATA[<p>Got an invitation to Google Wave today. The problem I find immediately is the lack of structure. Say what you will about the restrictions of email or IM, but the same restrictions of those ways of communication, namely time-flow or thread-flow, are also well enforced structures to keep things sane. Wave takes away these and substitutes &#8220;playback.&#8221; Unfortunately, playback is not natural. (The other way is to fall back on social convention to keep order, but that rarely works with more than 2 peers.)</p>
<p>I think there are two options here. Either structure needs to be explicitly enforced or presentation needs to be refined.</p>
<p>In the former, perhaps it is better to only allow replies in certain places. Perhaps it is better to only allow edits in certain places. Perhaps it is better to separate the two and keep the distinction between edit mode, thread mode, and conversation mode, and only allow mixing in very restricted settings (or require some extra steps to discourage its use). After all, in preparing a shared endeavor, the purpose should be defined and known ahead of time.</p>
<p>In the latter, perhaps a lot of hiding and collapsing should be used. Perhaps hyperlinks should be used for in-place edits that often hijack a topic. And now that subthreads can sprout like a tree, it makes little sense to retain the linear structure of conversations. Perhaps a topic based graph, or a conversation stack would be the more appropriate presentation metaphor.</p>
<p>Wave is a good idea, but not well thought out. In its attempt to differentiate, it has forsaken useability for chaotic flexibility, which would have had redeeming value, were it matched by equally ambitious presentation/visualization.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=226</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wired on the Gaussian copula</title>
		<link>https://blog.yhuang.org/?p=164</link>
		<comments>https://blog.yhuang.org/?p=164#comments</comments>
		<pubDate>Wed, 25 Feb 2009 04:37:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[covariance matrix]]></category>
		<category><![CDATA[default correlation]]></category>
		<category><![CDATA[Gaussian]]></category>
		<category><![CDATA[gaussian copula]]></category>
		<category><![CDATA[heck]]></category>
		<category><![CDATA[marginal distributions]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[pointless exercise]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=164</guid>
		<description><![CDATA[Because this article is spamming the internet today, I decided to read Li&#8217;s paper and learn what the heck is this Gaussian copula. For five years, Li&#8217;s formula, known as a Gaussian copula function, looked like an unambiguously positive breakthrough, a piece of financial technology that allowed hugely complex risks to be modeled with more [...]]]></description>
			<content:encoded><![CDATA[<p>Because <a href="http://www.wired.com/techbiz/it/magazine/17-03/wp_quant?currentPage=all">this article</a> is spamming the internet today, I decided to read Li&#8217;s paper and learn what the heck is this Gaussian copula.</p>
<blockquote><p>For five years, Li&#8217;s formula, known as a Gaussian copula function, looked like an unambiguously positive breakthrough, a piece of financial technology that allowed hugely complex risks to be modeled with more ease and accuracy than ever before. With his brilliant spark of mathematical legerdemain, Li made it possible for traders to sell vast quantities of new securities, expanding financial markets to unimaginable levels.</p></blockquote>
<p>And anyway, here is the <a href="http://www.defaultrisk.com/_pdf6j4/On%20Default%20Correlation-%20A%20Copula%20Function%20Approach.pdf">paper</a> referenced in the article.<br />
<span id="more-164"></span><br />
Firstly, so much for the sensationalism: so far as I can tell, the paper doesn&#8217;t say anything worthy of a Nobel Prize &#8212; but still it is mildly interesting. In fact, the whole point of the paper appears to be to introduce to the finance community an already known method for solving the inverse problem of distribution marginalization, that is, (non-uniquely) go from marginal distributions back to the joint distribution, by specifying a mediating copula that captures marginal-invariant joint structure. The technology is very straightforward, and Li didn&#8217;t invent it.</p>
<p>That aside, I did wonder, why the heck go through the motion of constructing a Gaussian copula (as in the article) if you assume your marginals and joint are all Gaussian to begin with and all you wanted to capture is the covariance matrix; you can just specify the joint Gaussian explicitly. It seems like a totally pointless exercise. After reading the paper though, I see that wasn&#8217;t really Li&#8217;s entire suggestion at all. He&#8217;s being descriptive rather than prescriptive of what his firm already did by casting it in the language of copulas, an interpretive generalization that allows for potentially more accurate modeling (of non-Gaussian marginals and complicated joint structure if so desired).</p>
<p>Now on to the accusations. The article says that Li tried to &#8220;model default correlation&#8221; using credit default swaps rather than ratings agency data. It turns out that wasn&#8217;t even a problem being solved in this paper. He suggested to use CDS market data to get implied <em>marginal</em> distribution, an established practice. As for how correlation is obtained from limited data, you&#8217;d have to blame one Greg Gupton:</p>
<blockquote><p>Having chosen a copula function, we need to compute the pairwise correlation of survival times. Using the CreditMetrics (Gupton et al. [1997]) asset correlation approach, we can obtain the default correlation of two discrete events over one year period.</p></blockquote>
<p>However, it is true that there is something funny going on with the concept of using market pricing to price other market instruments, when the only novel input for all of them must be what little information is collected from actual due diligence. A classic case of Garbage In Garbage Out in statistical modeling.</p>
<p>As somebody elsewhere wrote, this sort of thing would not pass muster in &#8220;real&#8221; engineering design. We&#8217;ve seen that dichotomy before between the absolutely error-free stricture of &#8220;hardware&#8221; design (chips and bridges) vs. the more lax attitude toward &#8220;software&#8221; design (operating systems and capital market systems). Maybe this dichotomy needs to go away.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=164</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On Penmanship in Chinese</title>
		<link>https://blog.yhuang.org/?p=154</link>
		<comments>https://blog.yhuang.org/?p=154#comments</comments>
		<pubDate>Thu, 29 Jan 2009 21:49:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[basis]]></category>
		<category><![CDATA[calligraphy]]></category>
		<category><![CDATA[first principle]]></category>
		<category><![CDATA[first principles]]></category>
		<category><![CDATA[matter]]></category>
		<category><![CDATA[muscle memory]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[penmanship]]></category>
		<category><![CDATA[result]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=154</guid>
		<description><![CDATA[I suppose good penmanship is the basis of good calligraphy, since calligraphy is mainly the addition of (variable) brush width to the structure of the characters. This bulk structure is really the key and it is particularly difficult to get correctly without muscle memory. That&#8217;s why they tell you to trace character books over and [...]]]></description>
			<content:encoded><![CDATA[<p>I suppose good penmanship is the basis of good calligraphy, since calligraphy is mainly the addition of (variable) brush width to the structure of the characters. This bulk structure is really the key and it is particularly difficult to get correctly without muscle memory. That&#8217;s why they tell you to trace character books over and over.</p>
<p>However, there is a way to figure this matter of structure from first principles (and perhaps generate a more unique style as a result), albeit with the tradeoff that you cannot be quick, you must be careful.<br />
<span id="more-154"></span><br />
The first principle for aesthetics is that the character must stand &#8230; this is something my old man told me, actually, so I didn&#8217;t figure this out myself, but it is very true. If you hold up the piece of paper and look at the strokes as struts of a building, it must look like the character is architecturally sound, i.e. reasonably symmetric if need be, balanced in weight so will not tip over, is not poorly supported with too small a bottom and too big a top, etc. This isn&#8217;t too difficult if the character is mechanically drawn, but the trick is to do it even with asymmetric calligraphic strokes and multi-part characters with asymmetric radicals and caps.</p>
<p>The second principle for aesthetics is about spacing, and this is much like optimal typography and typesetting. The strokes should be spread out evenly so that where they appear parallel, they appear to have nearly identical spacing as other such spaces. Otherwise there will be ugly bunching and voids. This is very difficult because the strokes are written in order so there is a pre-commitment issue. Once you commit to a particular stroke, it also commits the spacing requirements for the rest of the character. So one slightly off stroke and you are screwed. This is more a problem for large writing, since bigger mistakes are possible.</p>
<p>Then is the issue of multiple character layout. This wouldn&#8217;t be so much of an issue if all characters were the same shape and complexity, but they are not. Some are extremely sparse, and some are very dense. Some are tall and some are fat. They all have to be laid out on paper to look like they take up the same space and also evenly spaced from each other. There is also the compromise of making inter-stroke space appear similar in multiple characters. So one needs to deal with some visual artifacts and vision tricks. As a result, the characters will not all be the same size and will not be spaced evenly, so this is a very tricky thing to get right. You can have perfectly written individual characters but still a terrible collection.</p>
<p>And finally here is a side point: people say Simplified characters are uglier than Traditional characters for calligraphy. In fact this cannot be true. What happens is Simplified characters are sparser and sparser characters writ large are the most difficult to get correctly (not to mention there are no classic master&#8217;s character books to trace in Simplified). They are ugly only because (or to the extent that) they are not written well. The bastion of poor practioners (like me) is in small dense characters that distract from scrutiny and generally look pretty good no matter how you write them.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=154</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7, again</title>
		<link>https://blog.yhuang.org/?p=153</link>
		<comments>https://blog.yhuang.org/?p=153#comments</comments>
		<pubDate>Thu, 29 Jan 2009 06:56:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[continuous mode]]></category>
		<category><![CDATA[english ink]]></category>
		<category><![CDATA[everything]]></category>
		<category><![CDATA[home]]></category>
		<category><![CDATA[interaction]]></category>
		<category><![CDATA[monad]]></category>
		<category><![CDATA[posix subsystem]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[structure]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=153</guid>
		<description><![CDATA[Got it installed and seems like a clean update on Vista. Somebody must have cracked the whip on simplicity, since nearly everything involving user interaction got simpler. Since it is mostly feature extensions on Vista, it is quite stable. Some less noticed changes: * IE8 now runs all tabs and windows in separate processes, so [...]]]></description>
			<content:encoded><![CDATA[<p>Got it installed and seems like a clean update on Vista. Somebody must have cracked the whip on simplicity, since nearly everything involving user interaction got simpler. Since it is mostly feature extensions on Vista, it is quite stable.</p>
<p>Some less noticed changes:<br />
* IE8 now runs all tabs and windows in separate processes, so there is no longer a distinction between tabs and windows. There is also (finally) a Mozilla style jump-highlight in-page search. There is a convenient &#8220;In Private&#8221; mode that leaves behind nothing, but it is kind of stupid in that it doesn&#8217;t sandbox in cookies to delete them afterwards but in fact doesn&#8217;t appear to store them at all, breaking some sites&#8230; or maybe it&#8217;s just a bug. There are also these &#8220;accelerators&#8221; to web services (like smart tags on crack), not that useful in my opinion.<br />
* English ink input in continuous mode now displays recognitions in-place, rather than in typeface underneath.<br />
* Services for Unix (the POSIX subsystem) is much much improved and is actually usable for compilation.<br />
* Monad (or PowerShell), which got dropped from Vista, is in. Very nice.<br />
* Desktop backgrounds now come in sets of images, rather than one image.<br />
* Yet another new directory structure for user home directory. The &#8220;data&#8221; folders in the home directory like Pictures, Music, Movies, Documents are now symbolically separated into a &#8220;Libraries&#8221; indexing structure (kind of like in WMP), and apparently you can create multiple libraries. Not sure if this is implemented cleanly enough, but intersting.</p>
<p>That&#8217;s about it.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=153</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
