<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Casey Juanxi Li on Medium]]></title>
        <description><![CDATA[Stories by Casey Juanxi Li on Medium]]></description>
        <link>https://medium.com/@sometimescasey?source=rss-669c2f744e30------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bXvF9GY3kbeKcgNohHLB-Q.jpeg</url>
            <title>Stories by Casey Juanxi Li on Medium</title>
            <link>https://medium.com/@sometimescasey?source=rss-669c2f744e30------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:47:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sometimescasey/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Fake personalization in tech isn’t fooling anyone — lessons from architecture]]></title>
            <link>https://medium.com/@sometimescasey/fake-personalization-in-tech-isnt-fooling-anyone-lessons-from-architecture-3d58d8790ef4?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d58d8790ef4</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[marketing-automation]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 20:08:53 GMT</pubDate>
            <atom:updated>2021-11-25T20:08:53.287Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fake personalization in tech isn’t fooling anyone</h3><p><em>Original post: </em><a href="https://casey.li/fake-tech-material-dishonesty/"><em>https://casey.li/fake-tech-material-dishonesty/</em></a></p><p>Most people understand why <strong>material dishonesty</strong> is bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*1R3kYJ71HNMpuM3i6r4X6Q.png" /></figure><p>True hardwood flooring is more beautiful to us than laminate. We like a solid oak tabletop more than a cheap piece of particleboard from IKEA.</p><p>The average person can easily tell the difference just by walking on it. It’s in the grain, the way our body heat transfers, the way it bends and creaks. The use of true hardwood in a high quality home is more than just status signaling. It’s an objectively richer experience.</p><p>We naturally turn up our noses at materially dishonest things. They strike us as cheap and shameful. Yet tech is constantly pretending to be something it’s not, and we tolerate it. In some circles it is actively lauded as an engineering marvel or an act of sophistication.</p><p><strong>This is wrong.</strong> I will present two examples to illustrate why.</p><h3>1. “Personalized” generic content is an attempt to get something for nothing</h3><p>Everyone has seen an embarrassing mail merge failure: “Dear [FIRST_NAME] [LAST_NAME]”.</p><p>But I recently encountered a more subtle version of this on a popular marketing blog:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mzJNMLiBR1leVbKc.png" /></figure><p>I use Chrome extensions to block scripts and 3rd party cookies, and I never allow a website to have access to my location. So I got their fallback placeholder: <strong>“Your City”</strong>.</p><p>Natural Language Processing enthusiasts out will note that this fallback value has created <a href="https://en.wikipedia.org/wiki/Syntactic_ambiguity">syntactic ambiguity</a>. It’s no longer clear whether “will it be yours” is referring to my city or my business. It’s also weird that Your City is capitalized, because normal people don’t write like that.</p><p>The jarring, hacked-together nature of this sentence is so distracting that I have to open Chrome inspector to confirm my suspicions. Lo and behold, there is a &lt;span&gt; with an ID tag wrapped around the words “Your City”, confirming that this field is meant to be programmatically populated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*ZX5WL1gBaTNoFdOL.jpg" /></figure><h3>Materially dishonest tech, example 1: making an interaction seem local when it is not.</h3><p>We like local businesses for a reason. They are embedded in our local networks, which provide ways to get information about them and keep them accountable.</p><p>Would your rather buy a loaf of bread from a local baker or on Amazon? Most people still choose the baker. If the bread is moldy and stale, you can use the full arsenal of human social tools (an angry look, bad word of mouth to your neighbours) to create consequences for their negligence. If the bread is delicious, you can head back to the shop tomorrow, heap lavish praise on them, tip extra, etc etc.</p><p>This fake localized CTA was an attempt to gain all the trust and benefits that come from being a local business, without the accountability of actually being one.</p><p><strong>This is an attempt to get something for nothing.</strong> And humans don’t take kindly to that.</p><p>(For fantastic related blog post, check out <a href="https://signal.org/blog/the-instagram-ads-you-will-never-see/">Signal’s excellent but short-lived Instagram ads</a>.)</p><h3>2. If it’s not a real person, don’t try to make it look like one</h3><p>Most of us feel sheepish when we bump into a pole and then apologize. We usually follow up with “oops”, because we don’t want others to think that we talk to objects. People who do this are considered <strong>crazy</strong>.</p><p>So why would you put a machine in front of someone and try to trick them into thinking it’s human?</p><p>Yet companies do this all the time.</p><p>It has become trendy to send mass emails with real first and last names in the name field, to bait someone into clicking it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KYcolRe36AOHT5WJ.png" /></figure><p>But the gains with this approach are short-term. If your content is mediocre, the annoyance at being duped might be enough to earn you an “unsubscribe” or “mark as spam”. If your content is good enough to keep them subscribed, then this trickery wasn’t necessary in the first place.</p><h3>Materially dishonest tech, example 2: Making an interaction look human when it is not</h3><p>I recently encountered a particularly noteworthy example of this — noteworthy because of how much work was put into the hiding the true nature of what was going on. Details fuzzed for privacy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5OLKb_K6Q2IeI347.jpg" /></figure><p>A few weeks later:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5t7anwG9MpG051M8.jpg" /></figure><p>And here are the email headers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*FuekFLcz2O0d4SKOff_J1w.png" /></figure><p>So:</p><ul><li>A real email was entered into the “name” field of an admin email address, to make it seem like they wrote it;</li><li>The templates for the initial vs the followup vary in writing style (polite business formal vs a quick one-liner), just as a person may do in real life.</li></ul><p>I have to admit, this is almost admirable in terms of effort. If most automated mail-merges are laminate flooring, then this is laminate flooring with wood-grain texture stamped in, dipped in a faux-oak scent.</p><p><strong>But it is laminate nonetheless.</strong> As one might expect, the “connection” in this case never materialized. Given that the value of an introduction is mostly in the relationship of the people doing the introducing, it stands to reason that a “connection” created with zero human involvement will hold exactly zero human value, no matter how hard it tries to put out appearances.</p><p>There is nothing wrong with automation per se. Everyone likes ATMs. I get my money faster, and the bank teller is spared the monotony of dishing out $20 bills, leaving them free to deal with more interesting requests.</p><p>But humans are expensive, and material dishonesty in tech is usually an attempt to capture human upside without doing human work. <strong>This is impossible.</strong></p><p>Here are passages from <a href="https://www.gutenberg.org/files/35898/35898-h/35898-h.htm"><em>The Seven Lamps of Architecture</em></a>, by John Ruskin. Chapter 2 is about <strong>Truth</strong>:</p><blockquote>Surface Deceits. These may be generally defined as <strong>inducing the supposition of some form or material which does not actually exist</strong>; as commonly in the painting of wood to represent marble, or in the painting of ornaments in deceptive relief. But we must be careful to observe, that the evil of them consists always in definitely attempted deception […]</blockquote><blockquote>[…]To cover brick with plaster, and this plaster with fresco, is, there fore, perfectly legitimate […] But to cover brick with cement, and to divide this cement with joints that it may look like stone, is to tell a falsehood; and is just as contemptible a procedure as the other is noble.</blockquote><p>Nobody minds cheap laminate flooring in a child’s playroom: it is installed with the understanding that it is meant to be covered with crayons, dented, destroyed, and replaced in a few years’ time. There is nothing dishonest about it.</p><p>But we all know the disappointment of, say, paying top dollar for a charming cabin with beautiful photos on Airbnb, only to show up and discover that the “fireplace” is an LED screen, the plants are plastic, and the beautiful “wooden” breakfast nook is really made of particleboard. In such situations we feel deceived. If the customer service from the host turns out to be poor, we may be further disappointed, <strong>but we won’t be surprised.</strong></p><p>If the environment around us is fake, it is likely that <strong>the person who created that environment will be false too.</strong> We will learn not to trust them.</p><p>This is as true in woodworking as it is in writing code. I’ll close with this appeal from Ruskin:</p><blockquote>“I would have the Spirit or Lamp of Truth clear in the hearts of our artists and handicraftsmen…it is, indeed, marvellous to see what power and universality there are in this single principle, and how in the consulting or forgetting of it lies half the dignity or decline of every art and act of man.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d58d8790ef4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is worth censoring? A tale of two Chinese film-makers]]></title>
            <link>https://medium.com/the-pirate-ship/what-is-worth-censoring-a-tale-of-two-chinese-film-makers-6586fb072a3b?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/6586fb072a3b</guid>
            <category><![CDATA[cathy-yan]]></category>
            <category><![CDATA[censorship]]></category>
            <category><![CDATA[nomadland]]></category>
            <category><![CDATA[chloé-zhao]]></category>
            <category><![CDATA[dead-pigs]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Mon, 17 May 2021 08:02:44 GMT</pubDate>
            <atom:updated>2021-05-18T12:56:23.588Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4o70FSiZGqJ1oxipdQGNQ.jpeg" /></figure><p>Immigration is a weapon in the cold war for talent, and the <a href="https://www.theverge.com/2021/4/26/22403627/china-censored-chloe-zhao-oscars-nomadland-social-media-posts">CCP’s censorship</a> of Chloé Zhao’s Oscar was an ineffective defense.</p><p>Rumour has it that she said something unflattering about China a few years ago, but that seems like a red herring. As <a href="https://www.washingtonpost.com/opinions/2021/04/30/chloe-zhao-disney-china-the-eternals">Sonny Bunch hypothesized</a> in The Washington Post, the censorship of her award for directing <em>Nomadland</em> indicated graver concerns.</p><p><em>Nomadland</em> is a deeply individualist movie. It tells stories of people who insist on living freely and brightly, despite being written off by state and society. The movie is often framed as an indictment of American capitalism, but the characters never actually blame anybody for their situation. It simply is what it is, and they solve within the constraints of reality. Money. Heat. Food. A place to sleep. And they do it without despair or bitterness. Frances McDormand’s character sums it up aptly:</p><blockquote>“I’m not homeless, I’m just houseless. Not the same thing, right?”</blockquote><p>Cathy Yan’s <em>Dead Pigs</em>, on the other hand, is self-aware Chinese vignette at its best — and it plays well within the party lines of acceptable criticism. We meet a foolish pig farmer whose animals die from tainted feed. We meet his morose son, who works a lowly restaurant job, and lies to his father about finding success in “the big city”. And we meet Candy Wang, the farmer’s business-savvy sister, who refuses to sell her family home to make way for condos. She goes viral on social media for standing up to the money-hungry sons of bitches at the development company, but eventually relinquishes the house to help her bankrupt brother. Everyone is happy in the end.</p><p>A friend marveled to me that <em>Dead Pigs</em> was allowed to be distributed in China, while news of <em>Nomadland</em>’s Oscar was not. After all, isn’t <em>Dead Pigs</em> a critique of modern China, as much as <em>Nomadland</em> is a critique of modern America?</p><p><strong>Hardly.</strong> If you’ve ever watched the CCTV Spring Festival Gala, or this <a href="https://www.youtube.com/watch?v=7zOUJGYzHQY">heart-warming Peppa Pig commercial</a>, you know that <em>Dead Pigs</em> follows the formula of <em>Wholesome CCP-Approved Human Interest Skit 101</em>. Show some funny old village folks who don’t want to get with the times, chew out the urban businessman who has lost sight of family values, have them reconcile, and then resolve everything with a singalong.</p><p><em>Dead Pigs</em> is a charming admission that the CCP’s modern China stumbles on some edge cases, much the same way that we are charmed when a CEO pokes fun at themselves in public. They make themselves look relatable, without any real relinquishing of power.</p><p><em>Nomadland</em>, on the other hand, is a real indictment of the American social fabric. Families fail. Economies fail. The government fails. The heroes of <em>Nomadland</em> are left with a van, YouTube, and each other.</p><p>I think Zhao’s Oscar win was censored because she achieved it by showing up as a stranger in a strange land, holding a mirror up to America, and showing it the ugliest bits of itself. Contrast her story of immigration with the architect in <em>Dead Pigs</em>: a soggy white guy who failed his architecture exams back home, and has now fled to China to cash in on the social premium of having a Caucasian face. He’s a sad joke.</p><p>Chloé wasn’t a cultural sideshow. She took the Hollywood machine head on, and came out stunningly uncompromised in both humanity and artistic vision. She took Swankie and Linda May — non-professional actors who really did live in vans and work seasonal Amazon warehouse jobs — as her <a href="https://variety.com/2021/awards/news/nomadland-linda-may-swankie-chloe-zhao-oscars-1234958341/">plus-ones to the Oscars</a>. She played the real game — and won.</p><p>For all the flack that we give American politics, valuing the individual drive to flourish above social cohesion is a deeply American ideal. <em>Nomadland</em> is a quiet tribute to all who choose this difficult and sometimes lonely path. It is such a powerful story that an immigrant — an outsider — was able to see it, understand it, and tell it in a way that garnered the highest possible praise from the very heart of the American film-making establishment.</p><p>Forget trade deals and tensions in the South China Sea. The most devastating thing that one state can do to another is to steal the hearts of their best and brightest. America has been winning this game for decades, and if they play their cards right they can continue winning it for many more. To the CCP, Cathy Yan’s <em>Dead Pigs</em> is a welcome foil to Zhao’s story. Yan is an immigrant who found success in America’s most prestigious institutions (Princeton, Tisch, the WSJ, director of a DC film), but still chose to return home to tell a deeply Chinese tale.</p><p><em>Nomadland</em> is not a story that could have been told in China. Government can be corrupt, greedy, or flawed: but it cannot be irrelevant to human striving.</p><p>Allowing the latter would drive a stake straight through the CCP’s conception of society and nationhood. And no matter how prestigious Zhao’s awards are, that simply won’t do.</p><p>Censoring Zhao’s achievement was short-sighted, not to mention that the best way to bring attention to something is to try and hide it. Zhao has made it clear that she is a person who transcends national identity, and cares deeply about the human being underneath. I’ll end with the full version of the poem she recited at her Oscar acceptance speech:</p><blockquote><em>人之初 (</em>rén zhī chū<em>) People at birth,<br>性本善 (</em>xìng běn shàn<em>) Are naturally good (kind-hearted).<br>性相近 (</em>xìng xiāng jìn<em>) Their natures are similar,<br>习相遠 (</em>xí xiāng yuǎn<em>) (But) their habits make them different (from each other).</em></blockquote><blockquote><em>- </em><a href="https://en.wikipedia.org/wiki/Three_Character_Classic"><em>三字经 (Three Character Classic)</em></a></blockquote><p>—</p><p>Originally published at: <a href="https://world.hey.com/casey.li/what-is-worth-censoring-a-tale-of-two-chinese-film-makers-3775009e">https://world.hey.com/casey.li/what-is-worth-censoring-a-tale-of-two-chinese-film-makers-3775009e</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6586fb072a3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-pirate-ship/what-is-worth-censoring-a-tale-of-two-chinese-film-makers-6586fb072a3b">What is worth censoring? A tale of two Chinese film-makers</a> was originally published in <a href="https://medium.com/the-pirate-ship">The Pirate Ship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Honest Review of the Udacity React Nanodegree]]></title>
            <link>https://medium.com/swlh/an-honest-review-of-the-udacity-react-nanodegree-6f9af4a40434?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f9af4a40434</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[udacity-nanodegree]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Sun, 02 Aug 2020 18:47:03 GMT</pubDate>
            <atom:updated>2020-09-24T13:37:56.842Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Original post: </em><a href="https://casey.li/udacity-react-nanodegree/"><em>casey.li/udacity-react-nanodegree</em></a></p><p><strong>tl;dr: </strong>Excellent gamified learning for picking up basic React skills. Know basic HTML+CSS, JavaScript and ES6 before starting. Do not count on the Udacity community or credential to get you a job; only you can do that. Fast and helpful online technical mentors. Strong intro to Redux. Look elsewhere for React Native content.</p><p>I started the <a href="https://www.udacity.com/course/react-nanodegree--nd019">Udacity React Nanodegree</a> in May of 2020, enticed by Udacity’s 1 month free promotion. They market it as a way to pick up new skills during COVID-19, and for the most part this promise has held true. From a quasi-technical data science background, I’ve picked up my first proper software engineering role (off pre-established networks; the course doesn’t add much value on this front). The skills from this course have proven useful since day 1, but they are only an introduction.</p><p><strong>I am not affiliated with Udacity or any of the content producers mentioned below.</strong> I like Udacity’s mission of democratizing access to technical education. Nanodegrees are a somewhat opaque product, and I‘d like to share an accurate picture of what they accomplish.</p><h3>Debunking employment expectations: this gives you skills, but you’ll need to find your own job.</h3><p>Let’s debunk the front-page advertising: “Become a React Developer” and “Master this powerful UI library” are a bit of a stretch. The course by no means guarantees these things — this is 100% aspirational copy to draw you in.</p><p>A big orange callout box tells you that “the average salary for React Developers in the U.S. is 120k”. Reality check: unless you’re already an established front-end developer with a strong brand, and you’re using the course to upskill, it’s unlikely you’ll be hitting this comp out of the gate. Actually, it’s unlikely that you could have achieved this nowadays without knowing React or another front-end framework already.</p><p>The ideal candidate for this course is someone who knows HTML, CSS, how the DOM works, JavaScript+ES6, and is ready to go deeper on front-end development. If not and you have some other programming experience, allocate a month or two beforehand to pick up the basics.</p><p>(<strong>Do not write off front-end: it’s really easy to do poorly and really hard to do well.</strong> I tried to teach myself React in a weekend a few years ago, and ended up making a pile of rubbish).</p><p>Allow longer for pre-reqs if you’re literally starting from zero coding experience (but also pat yourself on the back, because you’re <em>awesome</em>).</p><p>The “career services” module of the course is the least useful offering. Pay attention to the common-sense advice on how to set up a professional LinkedIn + Github, if you’ve never done so before. Otherwise, move on. The “career coaches” are not engineers, so I did not book a session. (In general, I find it’s not a good use of time to seek advice on how to do something from people who are not doing the thing).</p><p>After graduation, you gain access to an alumni Slack where job postings occasionally appear. I am skeptical about the success rate and quality here. I actually posted a job here myself, for a friend who was looking to hire a data engineer. We ultimately decided that the risk of hiring an unknown stranger off the internet was not worthwhile, even with Udacity’s credential gating.</p><p>An <strong>introduction from someone who knows you</strong> and <strong>a strong personal brand</strong> are still your best bet. Not perfectly meritocratic, but unfortunately, Udacity has yet to change this mechanic of the modern job market.</p><h3>Great gamified intro to React. Excellent pedagogy on Redux.</h3><p>The quality of React content is great, especially for folks like myself who can lose motivation when self-teaching. I enjoy the gamified milestones, the constant % progress bar ticking up after each short video, and the satisfaction of earning little badges on projects. The instructor, <a href="https://ui.dev/">Tyler McGinnis</a>, has a strong personal brand outside of Udacity and an effective teaching style.</p><p>Some students were unhappy about the React content being “outdated” (i.e. the course appears to be from 2017 and uses class-based components, while <a href="https://reactjs.org/docs/hooks-intro.html">React Hooks</a> were released in 2018). I didn’t think anything was so outdated that it compromised my ability to progress. (This may be a testament to React’s staying power, because its basic ideas have remained stable. In the JavaScript world, <a href="https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f">constantly changing frameworks</a> have become a running joke).</p><p>I thought the course’s approach to teaching <a href="https://redux.js.org/introduction/getting-started">Redux</a> was very clever. (Redux is a popular state management library, but can be confusing to learn). You implement a simple version of Redux from scratch, and use it in a small app. You then strip out your homemade implementation and replace it with imports from the real Redux library, same function signatures and all.</p><p>This takes more time than reading docs or doing a quick tutorial, but gives a deep level of intuition for the Redux concepts of <em>store</em>, <em>action</em>, and <em>reducer</em>. I found it very satisfying.</p><h3>React Native content is too outdated. (~2017)</h3><p>Unfortunately, after a great start in the first two modules (React + Redux), the course finishes on a weaker note. The React Native content is outdated to the point of disrupting the learning experience. The number of outdated methods, deprecated libraries, and mismatched screenshots simply becomes too frustrating — I actually ended up purchasing <a href="https://www.udemy.com/course/react-native-the-practical-guide/">a separate React Native course entirely</a>.</p><p>The teaching quality does not decline: React Native has simply changed alot since 2017. That said, for a paid educational product, it is reasonable for students to be upset about this. You can always read docs, search StackOverflow, and tinker around for free. For me, Udacity’s core value add is to set up learning in a way that strikes the perfect balance between <em>too easy to be useful</em>, and<em> too hard to keep me motivated</em>. They delivered this in the React and Redux modules, but unfortunately did not deliver on React Native.</p><h3>Technical mentors are very helpful. Project reviews do have standards, but are much more lax than real work.</h3><p>I made heavy use of the Udacity technical mentor forum to ask technical questions about course concepts or project bugs. The mentors are largely knowledgeable and cheerful. If you ask specific questions, and point to your code repo in a way that makes it easy to reproduce your issue, you can expect a helpful reply in 1–2 hours.</p><p>Project reviews are generally done 4–5 hours after submission. Projects come with detailed rubrics around required components and functionality — but as long as these requirements are fulfilled, your project will pass. At a real job I would expect to be working on a much more complex codebase, which would require substantially higher standards on project organization and styling (both CSS and literal code style). For the sake of not discouraging learners, however, it’s understandable that the reviewers are a little more lax.</p><p>Udacity has put some work into spinning up an in-browser IDE for the course, which I found clunky. I never used this and opted to develop locally, since that is what you’ll be doing anyway in real life.</p><h3>Take advantage of pricing flexibility. ETA for completion is specific to you.</h3><p>Udacity support has some reasonable flexibility around pricing. I was close to submitting my final project near the end of a billing cycle, and asked if I could pay for an extra week instead of an entire month. They cheerfully allowed this.</p><p>The course has an estimated 4 month completion time. Depending on your prior experience and free time, it seems doable in anywhere from one month (all pre-reqs satisfied, 2–4 hours a day) to 6 months or more (i.e. if you have to start from scratch on Javascript and brush up on HTML and CSS). Keep in mind that Udacity (and many other sites like <a href="https://www.freecodecamp.org/">freeCodeCamp</a> or <a href="https://www.codecademy.com/">CodeAcademy</a>) provides plenty of free courses on front-end basics, so don’t pay for any Nanodegree until you’re confident that you’re ready to hit the ground running.</p><h3>Rushing to “graduate” defeats the point: use this as a springboard to learn more.</h3><p>The certificate <a href="https://confirm.udacity.com/2MDJHAVY">looks like this</a>, and I doubt any employer actually cares. Don’t rush to get the course done in order to “graduate” — that would be missing the point. <strong>The course is a great gamified way to push through the inertia of learning something new,</strong> and make you effective enough to enjoy doing more of it. The credential itself has little inherent value.</p><p>It will not deliver mastery or a career. Be skeptical of any educational product, Udacity or otherwise, which claims to do so. Only time and persistent effort will achieve this. That said, there is nothing wrong with paying for some educational scaffolding to increase your odds of success.</p><p>If you’re considering purchasing one of Udacity’s Nanodegrees, I hope this review has been useful. Please feel free to ask questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f9af4a40434" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/an-honest-review-of-the-udacity-react-nanodegree-6f9af4a40434">An Honest Review of the Udacity React Nanodegree</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PCA, visualized for human beings]]></title>
            <link>https://medium.com/@sometimescasey/pca-visualized-for-human-beings-47d19a122734?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/47d19a122734</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Sat, 16 Nov 2019 19:20:06 GMT</pubDate>
            <atom:updated>2020-08-02T14:27:19.921Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The original version of this blog post, with formatted LaTeX formulas, can be found at </em><a href="https://casey.li/pca/"><em>casey.li/pca</em></a></p><p>Principal Component Analysis (PCA) is often described by intro machine learning courses as follows:</p><ul><li>Dimensionality reduction.</li><li>Decorrelation of features.</li><li>Singular Value Decomposition / matrix factorization: M=UΣV^T</li><li>Projecting the data onto a subspace spanned by the top N eigenvectors of the feature covariance matrix.</li></ul><p>That’s alot of unhelpful words for someone who is new to the topic. I think we can build a better intuition for these ideas, with a few animations to help. PCA can be used for many types of data, but we’ll focus on <strong>images</strong> here.</p><p>I’ll assume a high-school understanding of statistics and linear algebra — nothing more.</p><p><em>(btw — these animations were created using a fork of </em><a href="https://github.com/3b1b/manim"><em>manim</em></a><em> — a super-cool Python library by the guy at </em><a href="https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw"><em>3blue1brown</em></a><em>.)</em></p><h3>The covariance matrix of an image</h3><p>What is the covariance matrix of an image? Let’s start with its definition.</p><p>Say we have X, a single image, flattened from a square D×D. As an example, if we started with an 8×8 square image, we would flatten to a single row of 1×64 pixels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*Iy2GaHy-9GgHuLr2.gif" /></figure><p>To keep things simple, assume we have no color channels (like RGB). This is a grayscale image, with a single value from 0 to 255 for each pixel. We can then normalize this scale to fall between 0 and 1. (<a href="#571e">see note 1</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/140/0*Z-j7kM9tqnl7Dv62.gif" /></figure><p>An image X could then be represented with something like this: a 1×64 dimensional vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*aWFuLELpTauP6MxyKg2Qkg.png" /></figure><h3>Ok, cool. So what’s the covariance matrix?</h3><p>Let’s ask <a href="https://en.wikipedia.org/wiki/Covariance_matrix">Wikipedia</a>. For a single pair of pixels Xi and Xj, it is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*yefH1nIRy-Ysc3NenzMC4w.png" /></figure><p>In general we can write this as a dot product:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*yVTaLJ7ySemVaaGwkX0JGA.png" /></figure><h3>Wait a second…expectation? μ?</h3><p>Aren’t we just talking about a single image right now?</p><p>Indeed, if we only had a single image, Xi would be exactly equal to E[Xi]. And X would be exactly equal to μ. It wouldn’t be meaningful to calculate covariance for a single image, just like it wouldn’t be meaningful to compute an average when you only have one sample. So let’s keep going.</p><h3>What if we had more X’s?</h3><p>Let’s say we had many different observations of X’s. For example, a bunch of handwritten 2’s. N observations, to be precise. A single observation of X is 1×64, but let’s drop the 1 to keep things clean.</p><p>So now we have a collection of X’s which is N×64. We’ll call this collection boldface <strong>X</strong>.<a href="#d8be">²</a> It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*hfNpb0lEUyXMtKiR.gif" /></figure><p><strong>X</strong> is getting complex, so let’s agree on some notation. <strong>X</strong> can be described by:</p><ol><li><em>An index i which runs from 1 to D², describing each of the D² pixels.</em></li></ol><ul><li>Continuing with our example above, D²=64.</li><li>We usually put i as a subscript: X_i.</li></ul><p>2. <em>An index n running from 1 to N, describing each “observation”, or different image.</em></p><ul><li>We usually put n as a bracketed superscript: X^(n)</li></ul><p>So, X^(5)_3 means “the value of the 3rd pixel in the 5th image”.</p><h3>Calculating μ</h3><p>Now we can meaningfully calculate E[Xi], the expected value for pixel i:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*rhLRM8a1XM3fH4ohANhOmQ.png" /></figure><p>Leave it to mathematicians to come up with complex notation for a simple idea!</p><p>All we are saying here is: if we take the ith pixel from all N images, add up their values, and divide by N, we get E[Xi]= the average value for pixel i. Easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*bDXRso2skwQ4rhbt.gif" /></figure><p>If we do this for every pixel, we get 64 different averages. We can then pack all of these into a single vector, μ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*6cKMAAC7MaUFhkC7VG_C8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*Svyl6ovoG6f42LNz.gif" /></figure><h3>Calculating cov(X,X)</h3><p>We are trying to understand cov(X,X)=E[(X−μX)(X−μX)].</p><p>To start, let’s take a look at the meaning of this — the covariance between a specific pixel i and specific pixel j:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*Q0KekCgsHVb2D159nntrpQ.png" /></figure><p>For every single picture, we calculate how much its pixel i differs from the average pixel i. We also calculate how much its pixel j differs from the average pixel j.</p><p>Then we multiply these two values together, for every possible pairing of i and j! How many do we get? 64×64 = 4096!</p><p>Our 4096 pairs can be neatly arranged into a square matrix like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*aLL2M61qEDRD9g5X.gif" /></figure><p>How many such square matrices can we make? N of them — one for each image.</p><p>Then we take the expectation, or mean value, of all N of these square matrices. That expression is equivalent to E[(X−μX)(X−μX)].</p><p>Note the following is true for any specific value, cov(Xi,Xj)=E[(Xi−E[Xi])(Xj−E[Xj])], from this mean matrix:</p><ul><li>It is <strong>large and positive</strong> if whenever pixel i is <em>higher</em> than average, pixel j tends to be <em>higher</em> than average (or vice versa).</li><li>It is <strong>large and negative</strong> if whenever pixel i is <em>higher</em> than average, pixel j tends to be <em>lower</em> than average (or vice versa).</li><li>It is <strong>close to zero</strong> when there’s a pretty even split between these situations. In other words, seeing a high value for pixel i doesn’t give you much useful information about pixel j — it’s higher as often as it is lower.</li></ul><h3>A thought experiment: filling in a canvas</h3><p>We established above that a given cov(Xi,Xj) gives us a measure of how “related” two pixels tend to be. If pixel i is dark, does pixel j tend to be dark as well? Or does it tend to be light? Or does it give us no information at all?</p><p>The first row of the covariance matrix, then, is all of the cov(Xi,Xj)’s for pixel i=1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*kmaqW7w0OTGk_zEFjO7Fhw.png" /></figure><p>So do a thought experiment with me. Let’s say I give you a blank 8×8 pixel canvas, and a covariance matrix, calculated on many samples of a digit that is unknown to you. I have a hidden image of this digit, and I will reveal it to you pixel by pixel. You have to try to fill in your canvas by guessing what the image looks like.</p><p>I tell you that, for example, the 50th pixel is pure black, so you fill in pixel 50 as pure black. <strong>But can you make any guesses about the rest of the image?</strong></p><p><strong>Well…yes!</strong></p><p>The 50th row of the covariance matrix tells you how the rest of the pixels in the image should be related to pixel 50. If cov(X50,X64) is a very negative value, this tells you that pixel 64 (in the bottom-right corner) should actually be very white. If cov(X50,X19) is a very positive value, that tells you that pixel 19 should be pretty dark.</p><p>In fact, you should be able to look at every pixel in the image and fill in a “guess” for the value, based on the dark pixel #50 that you now know about.</p><p>I could continue this entire exercise by telling you about pixel 51 as well. And 52. And 53. In fact, you could go through all 64 pixels and do this for each pixel, adjusting your guesses each time. And so on until you’ve covered the whole image.</p><p>So what will you end up with? Well, let’s say the hidden image I had was a 2, and our covariance matrix was calculated using many examples of 2’s. Chances are you’ll also end up with something that looks like a 2 — because every time I gave you a pixel, you went through and filled in / erased other pixels based on the relationships that we usually tend to see in images of 2s.</p><p>Now what if the hidden image had been something very different from a 2 — say, just a black line across the top of the image? Normally we’d never expect such a black line to appear in images of 2s, so its covariance with the pixels that normally do appear in 2’s should be around zero, give or take some noise. There is no obvious relationship. If we repeat the exercise above, the output probably wouldn’t look much like a 2 — we’d likely just get some random noise by chance.</p><h3>If we think of the covariance matrix as a transformation, what does it do?</h3><p>Thinking back to the thought experiment above, we can observe the following. Remember that our covariance matrix was calculated using a bunch of different images of 2’s.</p><ul><li>Applying that covariance matrix to an image of a 2 will tend to <strong>reinforce the pixel relationships that are commonly associated with 2’s.</strong></li><li>Applying that covariance matrix to an image that doesn’t look much like a 2 will just tend to result in noise.</li></ul><p>Thus we can think of this covariance matrix almost like a naive child that has only ever learned to draw 2’s:</p><ul><li><strong>If we give it something that seems consistent with a 2</strong> — say, the top curve or that bottom straight line — it will “fill in” the rest of the image based on the pixel relationships that tend to appear in 2’s.</li><li><strong>If we give it something inconsistent with a 2</strong>, it will probably just add some meaningless noise.</li><li><strong>And if we pass in a complete 2</strong>, it will probably just make the whole thing darker.</li></ul><h3>So what are the eigenvectors of the covariance matrix?</h3><p>Here’s some basic intuition about eigenvectors that we need:</p><ul><li>A matrix is a transformation.</li><li>An <strong>eigenvector</strong> for the matrix is able to pass through that matrix transformation without changing direction — only magnitude.</li><li>The corresponding <strong>eigenvalue</strong> is that change in magnitude.</li></ul><p>(If you don’t have this intuition, stop right now and <a href="https://www.youtube.com/watch?v=PFDu9oVAE-g">go watch this amazing video by 3blue1brown</a>.)</p><p>So go back to the covariance matrix we found in the previous step. What are its eigenvectors?</p><p><strong>They are images that are able to pass through the matrix without changing direction — only magnitude.</strong></p><h3>“…what do you mean by change direction?”</h3><p>To be fair, the human brain is bad at visualising things in more than 3 dimensions. So let’s think about images with only 3 pixels.</p><ul><li>Imagine the values [0, 0.2, 0.1], [0, 0.4, 0.2], and [0, 1.0, 0.5]. These vectors all “point” in the same direction. They only differ in magnitude:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/197/1*MILzz-lu4qyh2wzBlgTbhQ.png" /></figure><ul><li>Now imagine the values [0, 1, 1], [1, 1, 0], or [1, 0, 1]. These vectors do <em>not</em> point in the same direction, even though they have the same magnitude:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/1*p3bXZjPCmnJvUlep0sGJQw.png" /></figure><p>So in the context of a picture, “not changing direction” means the <strong>same pixels stay on</strong>. They may get lighter or darker, but they <strong>maintain their relative brightness/darkness to each other</strong>.</p><h3>So that’s why we use eigenvectors as a new basis…</h3><p>Now it should be a little more clear: the eigenvectors of the covariance matrix are images which are able to pass through that matrix and only get lighter or darker — <strong>but the pixel relationships do not change</strong>.</p><p>Specifically, an eigenvector with a large and positive eigenvalue will get longer — or in the context of an image, its <strong>pixels become more intense</strong> after passing through the covariance matrix.</p><p>We can imagine that if we’ve calculated our covariance matrix on a specific set of images — i.e. only a certain digit — the eigenvectors will necessarily encode structures that are <strong>very typical of that digit</strong> (at least, within your dataset).</p><p>In fact, we should be able to add a bunch of these eigenvectors up, <strong>in certain quantities</strong>, and get something that looks very much like our original image!</p><p>What are those quantities? That leads me to…</p><h3>Decorrelation and dimensionality reduction</h3><p>The covariance matrix was created by matrix-multiplying two identical things by each other, so it is real and symmetric (meaning, the first row is equal to the first column, second row to the second column, etc.):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*bXsEqxxQ6ro3XcnC46bnVw.png" /></figure><p>Eigenvectors of real symmetric matrices are <strong>orthogonal</strong> to each other. Again, it’s hard to imagine a 90 degree angle in a space with more than 3 dimensions, but all it means is that there is <strong>no redundant information in the eigenvectors.</strong></p><p>If we’re trying to construct our image by adding up a bunch of eigenvectors, each additional one that we throw in adds information that was not present in the others.</p><p><em>(If this doesn’t make sense intuitively, think of it this way: if you are at Point A and Point B is north-west of you, there is no way you can get to point B by only taking steps towards the north. You must also take some steps towards the west. We say north and west are </em><strong><em>orthogonal</em></strong><em> to each other.)</em></p><p>This is what it means for PCA to decorrelate features: by using eigenvectors as our new basis for representing the image, we <strong>automatically ensure that our basis is made of orthogonal vectors</strong>.</p><p>And what about dimensionality reduction? A K×K covariance matrix will have K eigenvectors, but you certainly don’t need to use them all to get a decent reconstruction. You can obtain decent reconstructions of MNIST digits with as few as 4 eigenvectors in your basis, when the eigenvectors are calculated from class-specific data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RhY717C4Zml108wn.png" /></figure><h3>How to find these eigenvectors, and how much of each eigenvector do we use?</h3><p>Singular Value Decomposition (SVD) refers to the operation in linear algebra that takes a matrix MM and factors it into the following components:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/105/1*cAG-h5p8Z4uA9zcWHY8m9g.png" /></figure><ul><li>M is our original matrix that we are trying to find eigenvalues for. In this case it is the covariance matrix that we calculated from all of our images.</li><li>U’s columns are the left singular vectors, and V’s columns are the right singular vectors. In the case of the covariance matrix which is <strong>positive semidefinite</strong>, U=V, and its columns are the eigenvectors we wish to find.</li><li>The values of the diagonals on Σ are the amount by which each of these eigenvectors get transformed when they go through the transformation defined by MM.</li></ul><p>Once we have U, we simply take the number of eigenvectors from it that we want. (We usually take the top n eigenvectors by eigenvalue.) We then “apply” (dot product) it with X in order to obtain the <strong>projection of </strong>X<strong> onto the new subspace spanned by our reduced </strong>U (which we will call W in the code below).</p><p>Implementing this in Python is actually not too bad — here’s an example of a class that could be used to do it. <strong>pca_train()</strong> allows us to find the top n eigenvectors; <strong>pca_transform()</strong> allows us to use those eigenvectors to perform PCA on a given input image.</p><p>For an excellent explanation, check out <a href="http://cs231n.github.io/neural-networks-2/#datapre">http://cs231n.github.io/neural-networks-2/#datapre</a>.</p><pre><strong>class</strong> <strong>Pca</strong>:<br>    &#39;&#39;&#39;<br>    A simple class to run PCA and store the truncated U matrix for use on the test set.<br>    &#39;&#39;&#39;<br><br>    <strong>def</strong> <strong>__init__</strong>(self):<br>        self<strong>.</strong>W <strong>=</strong> None<br><br>    <strong>def</strong> <strong>pca_train</strong>(self, X, n<strong>=</strong>5):<br>        &#39;&#39;&#39;<br>        Helper function to perform PCA on X and store the chosen eigenvectors from U.<br><br>        If input X is T x d,<br><br>        transformed X&#39; is T x d&#39;<br><br>        Also saves the chosen columns of U to self.W.<br>        <br>        Based heavily on http://cs231n.github.io/neural-networks-2/.<br>        &#39;&#39;&#39;<br><br>        <em># PCA down to top n eigenvectors</em><br>        <em># Assume input data matrix X of size [T x d]</em><br>        cov <strong>=</strong> np<strong>.</strong>dot(X<strong>.</strong>T, X) <strong>/</strong> X<strong>.</strong>shape[0] <em># get the data covariance matrix</em><br>        U,S,V <strong>=</strong> np<strong>.</strong>linalg<strong>.</strong>svd(cov)<br><br>        <em># eigenvectors are returned sorted by eigenvalue; get top n</em><br>        X_prime <strong>=</strong> np<strong>.</strong>dot(X, U[:,:n]) <br>        <br>        <em># save W = U[:,:n] for use again in testing; we only train</em><br>        <em># PCA on the TRAIN SET to prevent data leakage!</em><br>        self<strong>.</strong>W <strong>=</strong> U[:,:n]<br><br>        <strong>return</strong> X_prime<br><br>    <strong>def</strong> <strong>pca_transform</strong>(self, X):<br>        &#39;&#39;&#39;<br>        Use the previously trained U to transform an input X (i.e. test data)<br>        &#39;&#39;&#39;<br>        <strong>assert</strong> self<strong>.</strong>W <strong>is</strong> <strong>not</strong> None, &quot;pca_test() called when self.W is None. Did you call pca_train() first?&quot;<br>        <strong>return</strong> np<strong>.</strong>dot(X, self<strong>.</strong>W)</pre><p><strong>Note 1:</strong> Usually in RGB representations of images, 0 represents black while 255 represents white. For simplicity we flip this convention in the post to keep things simple: 1 is a completely black pixel, and 0 is completely white.</p><p><strong>Note 2:</strong> This boldface <strong>X</strong> notation to represent a batch of datapoints X is common but certainly not standard. ML literature notation tends to be all over the place. 😔</p><p><em>If you enjoyed this, find more writing at </em><a href="https://notsquirrel.com/"><em>notsquirrel.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47d19a122734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Humans are terrible at stating objective functions: Emotional intelligence for the…]]></title>
            <link>https://medium.com/@sometimescasey/humans-are-terrible-at-stating-objective-functions-emotional-intelligence-for-the-b2cf93dd5a23?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2cf93dd5a23</guid>
            <category><![CDATA[relationships]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Wed, 24 Oct 2018 18:26:10 GMT</pubDate>
            <atom:updated>2020-08-02T14:31:24.588Z</atom:updated>
            <content:encoded><![CDATA[<h3>Humans are terrible at stating objective functions: Emotional intelligence for the engineering-minded</h3><p>The trope that engineers lack emotional intelligence is grounded in this truth: <strong>when someone expresses a need, the objective function that they really want you to maximize is almost never the one that they are telling you to maximize.</strong></p><p>And here’s the kicker — it’s almost <strong>impossible to get people to tell you the true function they want you to maximize</strong>. Outside the context of an exceptionally functional and trustful relationship, doing so is usually more emotional honesty and vulnerability than most people, myself included, are willing to bear.</p><p>This has been a difficult idea to wrap my head around for the last twenty-odd years. When solving problems in STEM disciplines, the objective is usually stated explicitly:</p><blockquote>Here is your objective function: take its derivative with respect to something and set it to zero.</blockquote><p>While the mechanics may be hard, there is no question about what you are trying to achieve.</p><p>A requirement of my current Master’s program is a course on communication — the kind of squishy content that usually makes eyes roll. Here’s a sample exercise: take the following statement from somebody expressing an unmet need, and evaluate the response for defensiveness.</p><blockquote><strong>Alice:</strong> “I’m always the one cleaning up the dishes. I wish you’d be less careless around the house.”</blockquote><blockquote><strong>Bob:</strong> “What do you mean? I don’t think you’re being entirely reasonable. You know I’m busy and I don’t have time to always clean up. Also, I do the laundry more often than you.”</blockquote><p>Our instructor would call this a defensive response. Stated otherwise, this is an <strong>outright rejection of the other party’s proposed objective function, in favour of your own.</strong> When I do this, I probably don’t even realize that I’m allowing another objective function to override. Typical suspects for this override are:</p><ul><li>My desire to believe that I am a good person</li><li>My desire to perceive myself as intelligent/competent/worthy</li><li>To get recognition for my own unappreciated efforts, etc.</li></ul><p>This is the most unproductive form of civil communication. One layer of hell underneath, we have passive-aggression or outright toxic hostility — but we won’t get into that.</p><p>Slightly more enlightened — focus on the stated objective function (maximize clean dishes):</p><blockquote><strong>Alice:</strong> I’m always the one cleaning up the dishes. I wish you’d be less careless around the house.</blockquote><blockquote><strong>Bob:</strong> I’m sorry, you’re right. I’ll try to be better about the dishes in future.</blockquote><p>Most people stop here and think it’s enough, myself included. Acknowledge the proposed objective function, and present a promise and intention to maximize it. Seems pretty good…right?</p><p>…well, sort of. For most problems of an engineering nature, this is indeed the most productive thing to do. If a bulb is burned out, you change the bulb. If a regular expression captures the wrong patterns, you revise the regular expression. There’s really nothing deeper to it.</p><p>The following absurd example should demonstrate why this fails for human needs:</p><blockquote><strong>Bob:</strong> I don’t feel like there’s enough intimacy between us.</blockquote><blockquote><strong>Alice:</strong> Ok, I acknowledge that, and I agree that it’s my responsibility to help fix it. Let’s agree on measures of intimacy. How about hugs, kisses, and a good roll in the hay? We can put up a dashboard of the actions that have occurred each week, assign weights to each, and hold each other accountable to reaching our weekly intimacy goal.</blockquote><blockquote><strong>Bob:</strong> …</blockquote><p>What would ideally happen (and this almost never happens):</p><blockquote><strong>Bob:</strong> I don’t feel like there’s enough intimacy between us.</blockquote><blockquote><strong>Alice:</strong> That sucks — I love you and I don’t intend for you to feel that way. Can you tell me why?</blockquote><blockquote><strong>Bob:</strong> Sure. You’ve been really busy with your new job — you leave really early in the morning, you come back late at night, and even when you’re at home, you’re on your phone and you don’t really seem to be paying attention. It makes me feel like my thoughts and the work that I’m doing matters less to you than your work, which really hurts. In fact it hurts because I’m not 100% sure myself that what I’m currently pursuing is worthwhile, and I value your opinions, whether explicitly or implicitly stated. I’m worried that I’m a worthless piece of garbage who is deluding myself with my silly little projects while you go off into the world doing things that actually matter to people. I’m not confident that I’m doing something worthwhile with my life.</blockquote><blockquote><strong>Alice:</strong> Oh my gosh, how can you think that? (proceeds to explain to Bob why she thinks he is amazing)</blockquote><p>But it’s difficult to be emotionally honest enough with yourself to reach this Bob-like level of awareness. Sometimes you can’t even tell yourself what your under-optimized objective function is, let alone someone you love and trust. And as for saying this to someone who you don’t trust or even like…well, it’s easy to see why that’s impossible, even if they go to the (unlikely) effort of asking.</p><p>Further complicating the matter is the fact that if you don’t ask about someone’s feelings in a genuine manner, in the context of a trustful relationship, you’re likely to piss them off <em>more</em> than if you had just focused on the literal thing they asked for. Not only are we humans terrible at recognizing our own emotional needs, we’re also resentful of any suggestion that we might need our emotions taken care of, as opposed to some empirical objective. It makes us feel weak and selfish.</p><blockquote><strong>Alice:</strong> I’m always the one cleaning up the dishes. I wish you’d be less careless around the house.</blockquote><blockquote><strong>Bob:</strong> It seems you are upset that I don’t help more often around the house. Is that it?</blockquote><blockquote><strong>Alice:</strong> …yes, that’s literally what I just said.</blockquote><blockquote><strong>Bob:</strong> Can you tell me why it bothers you?</blockquote><blockquote><strong>Alice:</strong> What do you mean, why does it bother me? Don’t give me that psychology bullshit from communications class, this isn’t a therapy session about my feelings. It’s about the damn dishes, ok? It’s really not that deep. Don’t try to pretend like I’m the problem here. Just do the friggin’ dishes.</blockquote><p>Obviously, Alice is lying to herself. We want people to maximize our true objective functions, but we don’t want to have to tell them what they are, and we also don’t want to know that they are doing it.</p><p>It’s a tall order to ask of someone. How do you get better at doing something when you aren’t allowed to ask what it is, and can’t even say that you’re doing it?</p><p>Fortunately there are two things to guide us: <strong>wisdom</strong> and <strong>feedback</strong>. <strong>Wisdom</strong> is the knowledge given to us in texts like <em>The Dhammapada</em>, or <em>Getting to Yes</em>, or <em>How to Win Friends And Influence People</em>. These books point us to the existence of these hidden emotional objective functions, in ourselves and in others, that we can begin to perceive if we pay mindful attention. <strong>Feedback</strong> is built into us in the form of emotions themselves: it naturally feels good to resolve a conflict, or get deeper, more meaningful engagement from somebody. The human ancestors who took care of the emotional needs of others were liked, kept around, and invited to share in the kill. They survived.</p><p>The usual engineering toolkit for problem solving is ill-suited to dealing with human emotion and conflict, but that doesn’t mean we are defenseless against this class of problems. Years of evolution and literature can tilt the odds in our favour to make the learning cycle a little shorter and a little more efficient. We just have to pay attention to the tidbits of information that they offer up.</p><p><em>Post originally published at </em><a href="https://casey.li/objective-function-emotional-intelligence/"><em>casey.li</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2cf93dd5a23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building TensorFlow from source for SSE/AVX/FMA instructions: worth the effort?]]></title>
            <link>https://medium.com/@sometimescasey/building-tensorflow-from-source-for-sse-avx-fma-instructions-worth-the-effort-fbda4e30eec3?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbda4e30eec3</guid>
            <category><![CDATA[cpu]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[convolution-neural-net]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Fri, 15 Jun 2018 17:43:58 GMT</pubDate>
            <atom:updated>2020-08-02T14:36:13.119Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Post originally published at </em><a href="https://casey.li/tensorflow-from-source/"><em>casey.li/tensorflow-from-source</em></a></p><p><strong>tl;dr:</strong> Yes. I got ~40% faster CPU-only training on a small CNN by building TensorFlow from source to use SSE/AVX/FMA instructions. Look at <a href="https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions">some example build flags</a>. Then <a href="https://www.tensorflow.org/install/install_sources">do it</a>!</p><p>MNIST is the “Hello World” of machine learning, and TensorFlow’s <a href="https://www.tensorflow.org/versions/r1.0/get_started/mnist/beginners">MNIST For Beginners</a> is a pretty user-friendly way to get started. As user-friendly as ML can get, anyway.</p><p><a href="https://www.tensorflow.org/versions/r1.0/install/">Installing TensorFlow</a> from the recommended pip .whl is quick and painless. But upon testing my installation, I got these “warnings”:</p><pre>&gt;&gt;&gt; import tensorflow as tf<br>&gt;&gt;&gt; hello = tf.constant(&#39;Hello, TensorFlow!&#39;)<br>&gt;&gt;&gt; sess = tf.Session()<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.<br>W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn&#39;t compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.<br>&gt;&gt;&gt; print(sess.run(hello))<br>b&#39;Hello, TensorFlow!&#39;</pre><p>A quick Google search yields this <a href="https://github.com/tensorflow/tensorflow/issues/8037">GitHub thread</a>, which has plenty of advice about how to turn the warnings off.</p><p><strong>But wait!</strong> <em>“Could speed up CPU computations”</em>? That sounds pretty good. However, the only way to take advantage of these speed improvements is to <a href="https://www.tensorflow.org/install/install_sources">build TensorFlow from source</a>.</p><p>Funny though — TensorFlow actually warns you about doing just that. Venture into this uncharted territory at your own risk, kiddo — here be dragons:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*BRbEg3gJ_Jdxk9OX.png" /></figure><p>I know people who will pay a few extra hundred dollars for a slightly-higher wattage microwave, just so they can save a few seconds every time they heat up lunch. If you’re one of these people, the feeling that you might be waiting around <em>longer than absolutely necessary</em> for training on a non-optimally configured install of TensorFlow might not sit well. But exactly how much of a difference will it make? Is it worth the dragons? What do these instructions even mean? In the name of science, let’s find out.</p><h3>Measuring training time using MNIST</h3><p>I used the <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_softmax.py">mnist_softmax.py</a> given in the tutorial as my first test. Recording the training time is pretty simple — just wrap some calls to time.time() around the training loop and print the elapsed time at the end, alongside the accuracy:</p><pre><em># run training step many times!</em><br>    start <strong>=</strong> time<strong>.</strong>time()<br>    <strong>for</strong> _ <strong>in</strong> range(2000):<br>        batch_xs, batch_ys <strong>=</strong> mnist<strong>.</strong>train<strong>.</strong>next_batch(100)<br>        sess<strong>.</strong>run(train_step, feed_dict<strong>=</strong>{x: batch_xs, y_: batch_ys})<br>    end <strong>=</strong> time<strong>.</strong>time()</pre><pre><em># .... [some lines not shown]</em></pre><pre>    correct_prediction <strong>=</strong> tf<strong>.</strong>equal(tf<strong>.</strong>argmax(y, 1), y_)<br>    accuracy <strong>=</strong> tf<strong>.</strong>reduce_mean(tf<strong>.</strong>cast(correct_prediction, tf<strong>.</strong>float32))</pre><pre>    <strong>print</strong>(sess<strong>.</strong>run(accuracy, feed_dict<strong>=</strong>{x: mnist<strong>.</strong>test<strong>.</strong>images,<br>                                        y_: mnist<strong>.</strong>test<strong>.</strong>labels}))<br>    <strong>print</strong>(&quot;Training time: {} sec&quot;<strong>.</strong>format(end <strong>-</strong> start))</pre><p><strong>“Wait a second,”</strong> you might protest. “That’s not even a real neural net! That’s just a multinomial logistic regression. That’s not computationally intensive enough to be interesting.” And a fair point you’d be making. Let’s also test it out on a small but real Convolutional neural network (CNN) for MNIST.</p><p>I made my own <a href="https://gist.github.com/sometimescasey/496beabb98da2fe10996f0d9b5428a6b">mnist_cnn.py</a> as an exercise, according to the instructions <a href="https://www.tensorflow.org/versions/r1.0/get_started/mnist/pros">here</a>. But it’s basically identical to TensorFlow’s example file at <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_deep.py">mnist_deep.py</a>.</p><h3>What is SSE3, SSE4.1, SSE4.2, AVX, AVX2, FMA? And why would they make Tensorflow faster?</h3><p>SSE stands for <strong>Streaming SIMD Extensions</strong>, and SIMD stands for <strong>Single Instruction Multiple Data</strong>. In short, it sounds like these instructions allow your CPU to behave a little more like a GPU, doing the same operation on multiple data objects, instead of processing them one at a time. Handy for processing 3D graphics or — you guessed it — training layers of a neural net.</p><p>The <a href="https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions">AVX (Advanced Vector Extensions) and FMA (Fused Multiply Add)</a> instructions are also extensions to SIMD operations.</p><p>Tech-wise, the <a href="https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions">Wikipedia</a> and <a href="https://www.intel.com/content/www/us/en/support/articles/000005779/processors.html">the Intel documentation</a> for SSE goes far over my head. If anyone can ELI5, please do!</p><h3>So how do I build Tensorflow with support for SSE/AVX/FMA?</h3><p>First, read all of TensorFlow’s <a href="https://www.tensorflow.org/install/install_sources">instructions on building from source</a> for your OS.</p><p>Depending on your specific configuration, you may want to <a href="https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions">consult this thread</a> and pick your own particular set of flags for the build process. Here’s what I used when I got to the bazel build portion of the instructions:</p><pre>bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both -k //tensorflow/tools/pip_package:build_pip_package</pre><p>I did not use --config=cuda for this particular build as I am doing a CPU-only build. A fun next step would be to try to optimize for the fastest CUDA-enabled Tensorflow build using an NVIDIA GPU!</p><p>The build process took much longer than expected — 6718.2s or <strong>almost 2 hours</strong> on my laptop. Plan accordingly and make sure you’ll have access to power.</p><p>This will generate a build_pip_package script. Run this to build a .whl file, which you can output to /tmp/tensorflow_pkg or another folder of your choice.</p><pre>bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg</pre><p>Finally, cd into the repo where you built your .whl, and run pip install [filename of .whl]. Everything else should look exactly the same.</p><h3>The result? 43% speed improvement on a small CNN</h3><p>Here are the results on the CNN. Totally worth the effort!</p><p><strong>File: </strong><a href="https://gist.github.com/sometimescasey/496beabb98da2fe10996f0d9b5428a6b"><strong>mnist_cnn.py</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*6C5KHYAwr-DzYuy1JTFZ2g.png" /><figcaption>40% faster training time on MNIST CNN after building Tensorflow from source.</figcaption></figure><p>As might have been expected, mnist_softmax.py runtime didn’t show any meaningful change - maybe it doesn’t have enough calculations:</p><p><strong>File: </strong><a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_softmax.py"><strong>mnist_softmax.py</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*esojq09BxXS0D4LV4AD62g.png" /><figcaption>No noticeable effect for multinomial logistic regression.</figcaption></figure><p>I have not run the recommended 10,000 training steps to achieve 99.2% accuracy on the MNIST CNN (because ain’t nobody got time for that on CPU-only TensorFlow). Given this data, however, it’s good to know that I should be able to do so in about 17 minutes using the source-built TensorFlow, vs 30 min using the default install.</p><h3>Specs</h3><p>Here are the specs used to run the tests. YMMV:</p><ul><li>Ubuntu 16.04</li><li>conda 4.5.4</li><li>Python 3.6.5</li><li>Intel(R) Core(TM) i5–5200U</li><li>8GB DDR3</li></ul><p><strong>.whl used in regular install</strong>:<br><a href="https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp36-cp36m-linux_x86_64.whl">https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp36-cp36m-linux_x86_64.whl</a> <br>(Regular install: <a href="https://www.tensorflow.org/install/">instructions here</a>)</p><p><strong>Source (master branch)</strong>:<br>git clone <a href="https://github.com/tensorflow/tensorflow">https://github.com/tensorflow/tensorflow</a> <br>(Building from source: <a href="https://www.tensorflow.org/install/install_sources">instructions here</a>)</p><p>Found this useful? Originally published at <a href="http://notsquirrel.com/tensorflow-from-source/">notsquirrel.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbda4e30eec3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a static blog using Jekyll]]></title>
            <link>https://medium.com/@sometimescasey/setting-up-a-static-blog-using-jekyll-dc86154066eb?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc86154066eb</guid>
            <category><![CDATA[static-site-generator]]></category>
            <category><![CDATA[jekyll]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Wed, 13 Jun 2018 16:53:47 GMT</pubDate>
            <atom:updated>2018-09-19T14:35:34.739Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve run my blog off WordPress for 6 years, but finally made the switch to a static site generator and never looked back. For more thoughts on why you might want to choose a static site over Wordpress, check <a href="http://zapor.io/wordpress-vs-jekyll/">this article</a> here.</p><p><a href="https://jekyllrb.com/">Jekyll’s front page quickstart instructions</a> literally do get you up and running in seconds:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*LvNEERZroBjG5Wul.png" /></figure><p>…but if you need a little more guidance, let’s start from the top.</p><h3>1. Install Ruby and RubyGems</h3><p>Jekyll is a Ruby “gem”. So before you can gem install anything, you have to install Ruby, and its package manager, RubyGems.</p><p>Follow the <a href="https://www.ruby-lang.org/en/documentation/installation/">instructions for your computer here</a>.</p><p>RubyGems should come with Ruby by default. If you don’t have it, you can <a href="https://rubygems.org/pages/download">install it separately</a>. Again, the instructions will be platform-specific, so Google around.</p><p>(What’s a package manager? gem for Ruby = pip for Python, apt-get for Ubuntu, npm for JavaScript, etc.)</p><h3>2. Install Jekyll and Bundler</h3><p>Obviously you need Jekyll. Bundler is a dependency manager for Ruby projects, ensuring that you have the required gems and versions. Install them both:</p><pre>gem install bundler jekyll</pre><h3>3. Create a new Jekyll site</h3><p>Run the following command to populate a new folder called my-awesome-site. The newly generated files for your Jekyll site will live here:</p><pre>jekyll new my-awesome-site</pre><h3>4. Build and locally serve your new Jekyll site</h3><pre>cd my-awesome-site<br>bundle exec jekyll serve</pre><p>Let’s break this down. Once you cd into your newly created directory, you run the second line which tells Jekyll to build and serve up your website to localhost:4000.</p><p>Actually, running jekyll serve by itself may work. bundle exec jekyll serve simply uses Bundler to run the command instead, ensuring that all required gemfiles are available. You can read more about it <a href="https://bundler.io/man/bundle-exec.1.html">here</a>.</p><h3>5. Open a browser and go to <a href="http://localhost:4000/">http://localhost:4000</a></h3><p>If you’ve done everything right, you’ll have a nice new blog that looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*4unWZ2Iot1Gu5XlA.png" /></figure><h3>6. Notice that the server is still running!</h3><p>If you head back to your Terminal where you ran the serve command, you’ll notice that your server is still up and running, and will continue to run until you shut it down using ctrl+c:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*8UG0a5oMjPCc4gKA.png" /></figure><p>While the server is running, any changes that you make to your website’s files will be picked up and re-processed. Any errors that occur will show up in your Terminal as well.</p><h3>7. Try editing a post</h3><p>Using another Terminal window or your file explorer, head into the _posts folder of your website. You’ll see a file called YYYY-MM-DD-welcome-to-jekyll.markdown. Open this up in a text editor and give it some edits. Hit save.</p><p>Take a look at your Terminal where the server is running — you should see that the edit has automatically been picked up and your file is being regenerated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*7CjPYBDqpNtYTj4c.png" /></figure><p>Refresh the localhost:4000 site in your browser and click into your post - you should see your changes reflected.</p><p>As you can imply, auto-regeneration for your site can be enabled or disabled. I find it useful for doing and previewing changes live.</p><h3>8. Make a new post</h3><p>You can always start from scratch in any text editor, but I find it easier to copy existing posts.</p><p>Inside the _posts folder, copy the YYYY-MM-DD-welcome-to-jekyll.markdown file. Change its filename, perhaps to a different date or a different title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*tYFuox89G8HcY_Aw.png" /></figure><p>Change its <strong>front matter</strong>, which sits between two --- markers at the top of the file. This is what determines the post meta-data: title, date¹, permalink, categories, and many other properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/0*O_0i99gqftKgt4u9.png" /></figure><p>Again, your running Jekyll server should pick up this new file and generate it into HTML. It will also have updated your homepage to show the new post. Refresh to see it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*CVuKIVNiJscZYybz.png" /></figure><h3>8. Upload contents of _site folder to your server!</h3><p>Your site structure is generated into the _site folder. Once you’re happy, everything inside _siteshould be uploaded to the root of your online site at public_html or equivalent.</p><p>You’ll notice some familiar elements, such as index.html. You’ll also notice that some folders have been created for the post categories that we’ve specified in our front matter (i.e. jekyll and updates).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*mZ_QQ1OR9VB2_2AH.png" /></figure><p>Well done! You’ve just created your first Jekyll blog.</p><p>In the next post, I’ll get into customization, editing page templates and CSS, and other useful options.</p><h3>Notes</h3><h4>¹ How does Jekyll handle post dates? Does it use the filename?</h4><p>No. The date in the front-matter is what determines your blog metadata, and it must be entered in the specific format specified in the example post (i.e. 2018-06-13 11:11:03 -0400).</p><p>Note that the date in a post filename and the date in the post front-matter do not actually have to match.</p><p>So why do we need a date in the filename at all? Jekyll will pick not pick up a post unless its filename is in the format YYYY-MM-DD-name-of-post.ext.</p><p>(Jekyll works with other markup languages too, besides Markdown: <a href="https://jekyllrb.com/docs/posts/">read this.</a>)</p><p>Lastly, a handy feature: default Jekyll behaviour will not display a post that is dated for the future. This means that you can write a future-dated post, and not have it appear on your site until that date arrives.</p><p>Found this useful? Originally published at <a href="http://notsquirrel.com/jekyll-setup/">notsquirrel.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc86154066eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Skin In the Game, dogs vs. wolves, and why some jobs should be automated away]]></title>
            <link>https://medium.com/@sometimescasey/skin-in-the-game-dogs-vs-wolves-and-why-some-jobs-should-be-automated-away-4cbed1066b6d?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cbed1066b6d</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[skin-in-the-game]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[nassim-nicholas-taleb]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Tue, 29 May 2018 12:25:14 GMT</pubDate>
            <atom:updated>2020-08-02T14:37:23.891Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Original: </em><a href="https://casey.li/dogs-vs-wolves/"><em>casey.li/dogs-vs-wolves</em></a></p><p>Current tech fear-mongering seems to be centered around two concerns:</p><ul><li>The AI singularity will occur and super-intelligent robots will enslave us.¹</li><li>There will be mass unemployment due to automation.</li></ul><p>Let’s talk about #2.</p><p>Certain jobs <em>should</em> disappear due to automation. These are the jobs that should have been done by a computer in the first place, and we’d all be better off for it.</p><p>Nassim Nicholas Taleb’s recent book, <em>Skin in the Game</em>, claims that modern salaried life is essentially slavery. Economic definitions of slavery aside, many folks will probably agree with his assessment on pure intuition.</p><p>He uses the analogy²of the <a href="http://www.bartleby.com/17/1/28.html">Dog and the Wolf</a> from Aesop’s fables:</p><blockquote>A gaunt Wolf was almost dead with hunger when he happened to meet a House-dog who was passing by. “Ah, Cousin,” said the Dog. “I knew how it would be; your irregular life will soon be the ruin of you. Why do you not work steadily as I do, and get your food regularly given to you?”</blockquote><blockquote>“I would have no objection,” said the Wolf, “if I could only get a place.”</blockquote><blockquote>“I will easily arrange that for you,” said the Dog; “come with me to my master and you shall share my work.”</blockquote><blockquote>So the Wolf and the Dog went towards the town together. On the way there the Wolf noticed that the hair on a certain part of the Dog’s neck was very much worn away, so he asked him how that had come about.</blockquote><blockquote>“Oh, it is nothing,” said the Dog. “That is only the place where the collar is put on at night to keep me chained up; it chafes a bit, but one soon gets used to it.”</blockquote><blockquote>“Is that all?” said the Wolf. “Then good-bye to you, Master Dog.”</blockquote><p>Does modern “slavery” in the form of salaried employment harm anyone other than the individual who volunteers for it? Though it has deprived itself of the wolf’s dignity, the dog seems happy. Is it ok if done by choice?</p><p>Taleb doesn’t seem to think so. His reasoning seems obvious in retrospect:</p><blockquote>“People whose survival depends on qualitative “job assessments” by someone of higher rank in an organization cannot be trusted for critical decisions.”</blockquote><p>Why? He explains:</p><blockquote>“The employee has a very simple objective function: fulfill the tasks that his or her supervisor deems necessary, or satisfy some gameable metric.”</blockquote><p>Metrics are simplifications; simplifications are necessarily gameable. Instead of optimizing for producing value, the employee will optimize for themselves. Taleb argues that the only wolf-like employees are the small category of people who are assessed on metrics that are equivalent to the desired outcome (i.e. a trader’s P&amp;L or a salesperson’s numbers). Successful ones have wolf-like leverage, and they don’t hesitate to use it. Companies are terrified of losing them.</p><p>What about fulfilling tasks that the supervisor deems necessary? This manifests in two types of jobs.</p><p>One: a supervisor relies on the employee to provide valuable skills or decision-making prowess that cannot be obtained elsewhere. Like the skilled salesman or trader, such an employee also has leverage. They can always find another job, or offer their skills directly to the market in the form of a business. In other words, the individual functions as a productive unit in their own right — they are not simply an extension of their employer’s will. Most working people aspire to be like this.</p><p>Two: the employee is essentially a program, carrying out commands. They are not required or perhaps actively discouraged from exercising critical judgement in their role. Professional and financial services companies are rife with such roles, many high-paying. Programs can be expensive and sophisticated, but they are programs nonetheless.</p><p>Humans are not computers, and such “programmatic” roles combine the worst traits of both to make a crappy deal for everyone involved. The company gets a disengaged worker who optimizes for doing the minimum necessary without getting fired, which usually creates politics and bullshit. The employee gets to hate the slog of waking up on Mondays. Society is cheated of a better world, because instead of innovating solutions to hard problems, people are loafing, playing political games, and looking at pictures of cats to avoid stabbing their own eyes out at work. Nobody is better off. Enron, the IRS, most banks which collapsed in 2008 — no wonder most large bureaucracies look and feel like hell.</p><p>As automation pushes people out of jobs, there will no doubt be carnage in the short-term. Some folks may not recover within one lifetime without assistance. Government support of skills education may be necessary to prevent too grotesque of a disparity from forming. But this problem is hardly unique to our century: we handled steam, oil, and electricity, and we will handle whatever comes next.</p><p>Gunsmiths do not make butter, and dairy farmers do not make guns: they make their respective products and trade with each other. Gains from specialization are good. Automation will lead to an increased proportion of human brainpower being focused onto problems that only a human brain can solve. Computers will take care of the rest, humming away with no complaints or quashed ambitions. We will all be better off for it.</p><p>¹ I don’t understand AI well enough to speak confidently, but it seems the majority of singularity doomsday predictions are at least several decades too early, if not completely absurd.</p><p>It seems wrong to say, for example, that the recent <a href="https://ai.googleblog.com/2018/05/duplex-ai-system-for-natural-conversation.html">Google Assistant demo</a> passed the Turing test. While a very impressive demo, the conversations occured with busy shopowners who wanted to exchange necessary info and get the customer off the phone as quickly as possible. They had no reason to scrutinize the person on the other end for strange intonations or speaking tics, which are quite evident in the recording. The insertion of speech dysfluencies was a clever piece of aesthetic trickery, but hardly a meaningful step towards “the singularity”, so to speak.</p><p>And watch this Tesla on auto-pilot <a href="http://bgr.com/2018/04/06/tesla-autopilot-lane-centering-crash-video/">confuse a highway divider for a lane</a>. Yes, this is most likely fixable with situation-specific training data (or strong signals like colour-coded lane marker paint)…but guess who still has to realize the product gap, implement the solution, and monitor the training progress in real life? That’s right. Humans. We still have a long way to go.</p><p>² Taleb mentions that large bureaucracies select for predictable, controllable individuals. Tangential to his dog vs. wolf analogy, there is scientific evidence that dogs are less intelligent, more docile versions of wolves. Breeding may have selected for the <a href="https://news.nationalgeographic.com/2017/07/dogs-breeds-pets-wolves-evolution/">same genetic deletion in dogs</a> that causes Williams Syndrome in humans.</p><p>If you enjoyed this, find more writing at <a href="http://notsquirrel.com/dogs-vs-wolves/">notsquirrel.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cbed1066b6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Book Review: The Unwinding]]></title>
            <link>https://medium.com/@sometimescasey/book-review-the-unwinding-4a05d43a33c8?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a05d43a33c8</guid>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[american-dream]]></category>
            <category><![CDATA[democracy]]></category>
            <category><![CDATA[america]]></category>
            <category><![CDATA[american-history]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Sun, 24 Sep 2017 17:20:16 GMT</pubDate>
            <atom:updated>2018-09-19T14:39:07.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*pZLn9uBth3y7pfXBWixFSw.jpeg" /></figure><p>Read any collection of reviews on George Packer’s 2013 book, <a href="https://www.amazon.com/Unwinding-Inner-History-New-America/dp/0374534608"><em>The Unwinding</em></a>, and you’ll find something remarkable: a range of incongruent opinions, all claiming this book as validation of <em>their</em> particular place on the political spectrum. They stand testament to Packer’s skill as a journalist in capturing something as complex as America itself. For some, the book provokes an understandable sense of disappointment and anger at the country’s demise. Yet it is hard to imagine that this was Packer’s intended effect on the American people: if anything, <em>The Unwinding</em> is a compelling argument for independent thought and self-determination.</p><p>For the most part, Packer leaves his main characters in a melange of exhaustion, hope, and uncertainty. Tammy, the single mother, has broken her back for a lifetime to send her kids to college. Connaughton, the ex-lobbyist, takes a shower to wash off the stink of Washington. The Occupy Wall Street guy finds an intense episode of coherence and purpose, only to end up homeless and alone. Breitbart ends up dead. Yet not all is doomed. Among the book’s colourful cast, Thiel, Oprah, Jay-Z, and perhaps even Dean Price achieve some form of lasting success — the American Dream, writ large.</p><p>To grapple with the American Dream is to be held tense between two beliefs. On one extreme, the belief that society is a meritocracy and that outcomes are a badge of ability. On the other, the belief that all discrepancies are evidence of oppression: some folks take more than their fair share, and justice can only be achieved by tearing down the institutional machinery which enables them.</p><p>The dichotomy above may traditionally be described as right versus left. Yet in 2017 — a year of painful polarization — both ends of the political spectrum can be seen doing the same thing: finding an “other” to blame.</p><p>For the left, this “other” usually takes adjectives such as <em>heterosexual</em>, <em>white</em>, <em>male</em>, or <em>affluent</em>. This collection of words is often packaged and flattened further into the idea of <em>privilege</em>, which serves as a neat catch-all for anyone who is perceived to be playing with an unfair advantage. On the right, the chosen strawman is a contemptible mob of post-modern crybabies who spend their lives competing for the coveted title of “victim” — a political identity which confers institutional power and social cachet.</p><p>What is lacking in both these coping strategies is a belief in the power of individual action. To grant another group the status of “oppressor”, however insulting the word may be, is to admit that they hold power which can only be opposed at some higher level of group identity. The individual is lost in the argument. Both sides claim to fight for American ideals, while throwing away the core belief of the American Dream: that questions such <em>“who are you?”</em> or <em>“where did you come from?”</em> should pale in comparison to the almighty question of <em>“what can you do?”</em></p><p>Of the characters who found success in Packer’s book, there is a common theme among their worldviews: the individual in America can observe how the world behaves, take deliberate action, and achieve something worthwhile. Identity politics is at most a backdrop — ever present, but taking backstage to life itself.</p><p>Oprah “hated Black Power at Tennessee State in the early seventies, and didn’t care about politics at all”. She “had better relations with white people than with her own family, and later she would say that she never felt oppressed except by black people who disliked her very dark skin or envied her success”. For Jay-Z, dealing was a means to allow for rapping, music was just another hustle, and he approached them both with cold focus. All business. “Selfishness was a rational response to the reality he faced.” The only explicit mention of race comes at the end of the chapter, addressed to those who are unimpressed that Jay-Z only owns a small percentage of the Brooklyn Mets. He holds up his middle finger and reminds his critics that he was a black kid from a single parent house in the Marcy projects. “The fact that I have any ownership in this venue is fucking amazing”, he retorts. The implication: <em>I drew a tough hand in life, and I achieved the impossible with it, so fuck off.</em> The sentiment would feel right at home with one of Thiel’s: “Reject the unjust tyranny of chance. You are not a lottery ticket”.</p><p>Thiel is at once a stalwart promoter of libertarian values and a scathing denouncer of identity politics. His views are well-exemplified in one sound byte from the Republican National Convention of 2016:</p><blockquote>“When I was a kid, the great debate was about how to defeat the Soviet Union. And we won. Now we are told that the great debate is about who gets to use which bathroom. This is a distraction from our real problems. Who cares?”</blockquote><p>In <em>The Diversity Myth</em> and <em>Zero to One</em>, Thiel’s makes his values clear. He believes in objective truths about the nature of the world which transcend identity and culture. He believes culture wars are a crippling distraction from American progress. He believes in the power of an individual acting on reasoned conviction. This conviction occupies the top left corner of this well-known diagram in <em>Zero to One</em>, and he calls it Definite Optimism：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/0*deIal-PAhIdByNDF." /></figure><p>A streak of such definite optimism runs through Dean Price, the entrepreneur. He discovers, by chapter one, that working for a large company is simply another form of mind-numbing servitude. A lifetime of debt and countless mistakes in execution cannot mar his vision of a concrete and positive future. He sees an empty highway, and imagines a chain of Red Birch stores enlivening the countryside. He sees fallow tobacco fields, and imagines a new agrarian boom in the rural south, powered by individual farmers who supply the crop for a biodiesel revolution. Price is reminiscent of John Reber, the schoolteacher lauded by Thiel in <em>Zero to One</em>, who audaciously put forth a plan to reinvent the entire San Francisco Bay, and was taken seriously by Congress despite having zero experience or credentials.</p><p>Besides — in a world that seems to be falling apart, experienced and credentialed experts may actually deserve wariness instead of respect. Kevin Moore, the trader, disobeys the head of his desk and runs for the elevator as soon as the South tower is hit. “Fuck you and your fire drill procedure,” he says. “You want to fire me, fire me. I’m done”. As he heads uptown against throngs of clueless commuters, a sentiment arises which will repeat itself during the 2008 financial meltdown: “In a crisis you realized that society operated without anyone knowing deep down what the hell was really going on.”</p><p>Granted, Packer is no <em>Fountainhead</em>-thumping libertarian: he certainly believes in the significance of a broader social fabric. The very title of the book presupposes the idea that there was a large and important <em>something </em>to be unwound in the first place. The book’s cover is a rotting American flag, implying that it laments an abstracted and broken nation.</p><p>Yet salvation comes shining through in the very structure of the book itself. His chapters are not organized around bombastic theories on which evil machine is to blame, but around the remarkable lives and choices of individual people. What makes this book compelling is Packer’s quiet tribute to the self-determining American, with an empathetic eye for reality that Ayn Rand never quite found. Institutions may rot and crumble, and the very fabric of society may be torn asunder. But the human capacity to <em>do something</em> stands as bedrock: it is all you have, and yet somehow, it may be all you need.</p><p><em>If you enjoyed this, find more writing at </em><a href="http://notsquirrel.com/The-Unwinding/"><em>notsquirrel.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a05d43a33c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Rags to “Pre-Professional”: Losing sight of the American Dream]]></title>
            <link>https://medium.com/@sometimescasey/from-rags-to-pre-professional-losing-sight-of-the-american-dream-69e473b6a259?source=rss-669c2f744e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e473b6a259</guid>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[spacex]]></category>
            <category><![CDATA[american-dream]]></category>
            <category><![CDATA[ivy-league-schools]]></category>
            <category><![CDATA[life-lessons]]></category>
            <dc:creator><![CDATA[Casey Juanxi Li]]></dc:creator>
            <pubDate>Mon, 25 Jul 2016 14:41:41 GMT</pubDate>
            <atom:updated>2018-09-19T14:38:19.143Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>There are many things in life worth fighting for — the Ivy League rat race should be knocked a few notches down the list.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwjpERWceZthyLsDUvNeaQ.jpeg" /></figure><p>On Monday, July 18 2016 at 12:45am, sitting on the beach off Highway 401 in Cape Canaveral, I watched the SpaceX Falcon 9 shoot into the midnight sky. It was like watching a man-made sunrise. A team of human beings, in pursuit of one mission, had created a rocket which shook the earth with the force of a small earthquake. When it successfully came back down to Earth seven minutes later, the crowd erupted into applause.</p><p>Next to me, also watching with rapt attention, were my mother and father. 48 hours earlier, I had arrived at the airport to join them for our first-ever family vacation in Orlando, Florida. This is the land of Universal Studios and Mickey Mouse. Childhood “magic” is manufactured wholesale here, poured into odious plastic molds and turned around to beguiled parents and their wailing little charges for a few thousand dollars a pop.</p><p>I suppose it must be hard to tell your kids that you can’t afford Disney World. Between the flights, hotels, theme park tickets, and overpriced food, the bill can easily add up to $4,000 for a family of four — and that’s if you skip all the fun stuff like souvenirs and dinner with Cinderella. Throughout the weekend, my parents repeatedly apologized and expressed their lament for not being able to take me when I was little. I am now 23, and I am glad that they were rational enough to recognize the absurdity of dispensing months of salary on plastic, manufactured fun. No sane individual should be wasting money on Disney World. If a middle class American family somehow manages to accumulate several thousand spare dollars, it should not be exchanged for repeated chances to wait in line the boiling Florida sun for hours on end to ride a roller coaster for 10 seconds.</p><p>As a kid, however, rational adult logic simply crumbled in the face of your own emotions. Damn it, you just wanted to show up to that magical place as a kid and be a princess, or a superhero, or whatever your dreams were at that time, middle-class sensibility be damned.</p><blockquote>There is no concept of trade-offs or utility in Asian immigrant thinking. If something is cheaper, it is better. If it is free, it is the best.</blockquote><p>This was the first family trip we had taken in a long time where we didn’t feel constrained by money. My parents had always taken a very Chinese-immigrant approach to trade-offs, and this always caused a great deal of conflict and stress during family vacations. Example: given the choice between paying $16 to store their suitcases at the train station, versus lugging them around Washington DC monuments for 5 hours before the train arrived, they would choose to do the latter, stairs and security guards be damned. There is no concept of trade-offs or utility in Asian immigrant thinking. If something is cheaper, it is better. If it is free, it is the best.</p><p>They aren’t entirely wrong: watching the SpaceX Falcon launch didn’t cost us a thing, besides an hour of waiting time in order to get a good spot on the beach. The real reason why we didn’t feel constrained by money on this particular trip to Florida, however, is that I had paid for the majority of things which we had decided to do together. An airboat tour, a Cirque du Soleil show, tickets to the Kennedy Space Center, a rental car — these were items that would have been considered impossible when I was Disney-age, and $16 was worth a half-hour argument.</p><p>Like many other immigrant children, I vowed to myself that when I graduated from college and obtained employment, I would set myself on a path where we would never have to argue over $16 on a family trip ever again. Instead, I would be bankrolling the whole thing. Over the weekend in Orlando, I pulled out my card at each ticket stand and restaurant table, proudly announcing to them that they needn’t worry, because “I’ve got this”.</p><p>I had consciously purchased the right to do this four years prior. At the Wharton School, I had followed the masses down the pre-professional rabbit hole. This stood in contrast to “following your dreams”, which was, by popular understanding, an activity designated for unemployed people. I’d like to think this was an understandable choice. My parents were wonderful people — caring, available, and emotionally supportive. Toronto wasn’t a terribly racist or violent place either. Therefore, when the only sources of anguish and humiliation in your life came from the fact that you were poor, it is your first instinct as an empowered, self-determining adult to squash the bug of poverty out of your life.</p><blockquote>“Being poor is a disease, gotta hustle up a cure”</blockquote><blockquote><a href="https://www.youtube.com/watch?v=tB_dTt6QFm0">–Bun B, Paper Planes (Diplo Street Remix)</a></blockquote><p>The opposite of poverty is not being rich. It is being financially stable. When your goal is to elevate your quality of life to a state where you can reliably pay for your parents’ vacations, you do not risk your livelihood on your crazy childhood dreams. You learn to work with the system and jump through the hoops. You learn the accept the untruths and the fuzziness and the fog and haze which makes up banking and consulting and other Ivy League Careers for Risk Averse Kids Who Don’t Know What They Want To Do With Their Lives But Do Want To Make A Nice Living. You learn to stop questioning the fact that you are an overpaid PowerPoint assembly worker, or that the industry you work in may be constructed of perverse incentives. Every once in a while your childhood instincts may kick in — the instincts that, when faced with the question “What do you want to do when you grow up”, compelled you to answer with “be an astronaut” or “save the world”.</p><blockquote>“I think there are too many smart people pursuing internet stuff, finance, and law. That is part of the reason why we haven’t seen as much innovation.”</blockquote><blockquote>-Elon Musk</blockquote><p>Those instincts will remind you that your work isn’t really moving the needle of progress. Meanwhile the world is burning around you, and millions are living with excruciating pain and injustice. You then think that you might quit. Then, just as you start to consider pulling the trigger in earnest, the same part of your brain that compelled you to pay for your parents in Orlando also reminds you that it is nice to live in a building with security, and have health insurance, and nice brunches on Sundays. And so you do not move, and reason that this is the way things must be. We gently put our childhood intuitions down, euthanizing them like a beloved pet that dies in our arms, because we figure that they cannot withstand the pains of the world.</p><p>On Monday, July 18 2016 at 12:45am, however, I realized that by the age of 40-something, one man had compelled enough people to work with him to send a rocket into the sky and bring it home. One man had inspired the same child-like wonder and resolve that makes an eight year old say that they want to fly to Mars, in thousands of grown adults who were supposed to be too sensible to believe in this kind of thing. He proved to me that the world does not kill dreams, because his are clearly alive and well, and he has built them up with steel and sun.</p><p>It is easy to cower behind “pragmatism” or “sensibility” — they are handy covers for the fear that you may really pour your heart into the world, and have it be ripped into a million shreds.</p><blockquote>The pre-professional rat race is more insidious than simply telling a child not to pursue their dreams — it is more dangerous because it convinces them that it is their own decision.</blockquote><p>No eight year old says that they wish to format PowerPoints when they grow up. I think children have a strong natural sense of where to find truth in our world, and it is a tragedy that the rational “adult” mind can overpower a basic, instinctual sense of truth in order to push us towards professions where we cannot even define what it is that we do, let alone question its purpose. The pre-professional gotta-get-a-good-job-and-pay-my-mortgage-rat-race is more insidious than simply telling a child not to pursue their dreams — it is more dangerous because it convinces them that it is their own decision.</p><p>Some human minds like to rise to a challenge: they are energized by the nay-sayers and eager to prove them wrong. But what if the naysayer is yourself? How can you do right by the truth when you have convinced yourself that it is in your best interest to ignore it?</p><p>Yet I have noticed that the truth is persistent. It may not be loud underneath the noise of the world: against the backdrop of the Disney Worlds and the garbage of bureaucracy and office politics, the truth is an easy signal to lose. But there are men and women who amplify it, creating beautiful moments where the truth shines clear — and it is heartening that they are only humans too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e473b6a259" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>