<?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 Paperless Post on Medium]]></title>
        <description><![CDATA[Stories by Paperless Post on Medium]]></description>
        <link>https://medium.com/@LifeAtPaperless?source=rss-912b2dfa3dc8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d5k7w--7krsMcj3Bx5oOtQ.jpeg</url>
            <title>Stories by Paperless Post on Medium</title>
            <link>https://medium.com/@LifeAtPaperless?source=rss-912b2dfa3dc8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:21:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@LifeAtPaperless/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[The Event Classifier — Paperless Post Team Blog]]></title>
            <link>https://medium.com/life-at-paperless/the-event-classifier-paperless-post-team-blog-7c3b9a862f46?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c3b9a862f46</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Mon, 06 Nov 2017 15:48:39 GMT</pubDate>
            <atom:updated>2019-06-10T20:08:57.601Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Event Classifier</h3><p>November 6, 2017 by Ilan Man</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDRuZQpAz4efiXoxwD-A3w.jpeg" /></figure><p>Paperless Post allows you to send invitations to events (“RSVPs”) and greeting cards (“cards”). Examples of RSVPs include weddings, company holiday parties and baptisms, to name a few. Cards include birthday greetings and Mother’s Day well wishes. It’s critical for us as a business to understand how to classify these events so that we can make better informed business decisions. We don’t ask people what they’re creating because we want them to have the easiest possible user flow. That said, it’s helpful for us know what people are using our service for so we can improve it.</p><p>Today we’re going to better understand how exactly we classify greeting cards and events (hereafter simply referred to as “events”) at Paperless Post. We’ll review:</p><ul><li>How we think about event classifications</li><li>Complexities around text-based classification</li><li>Ways to understand if our classifier is good or not</li><li>Key aspects of our model</li></ul><h3>Categorizing events</h3><p>It’s important for us to know if a birthday party is for a 5 year old or a 55 year old. These are two different demographics which require different marketing strategies and different card designs, among other things. However it’s also important to distinguish between birthday parties and Christmas parties. As a result, we decided on a parent/child hierarchy for classifying events. At the top (primary level) are high level categorizations, such as <strong>birthday</strong>, <strong>wedding</strong>, <strong>personal</strong>, etc… Within each one of these lives a secondary classification — <strong>kids birthday </strong>vs<strong> adult birthday</strong> or <strong>wedding showers </strong>vs <strong>save the date</strong>. Finally, within each secondary category exists a tertiary category. Tertiary examples are <strong>baby shower</strong> vs <strong>teenage birthday </strong>vs <strong>tween birthday</strong> or <strong>wedding save the date</strong> vs <strong>engagement save the date</strong>. As you might imagine, classifying at the primary level is much more straightforward than the tertiary level. For one, there are fewer categories, so inherently fewer potential mistakes. In addition, it’s easier to distinguish between <strong>birthday</strong> and <strong>wedding</strong>. However, things get hairy at the secondary and tertiary level, which is why we need to build a model. For the purposes of this post, we’ll focus on the tertiary classification since that’s more interesting and generalizes to secondary and primary. Before diving into the model however, let’s try to solve this problem using simple heuristics.</p><h3>Heuristics and Nuance</h3><p>The crux of our classification algorithm is that it combs through the text of a user’s event and identifies key words that are used to correctly classify it. Simple enough. So to begin, let’s make a rule:</p><blockquote>If the term <strong>Halloween</strong> exists in the text of the event, then assign that event to the tertiary category <strong>Halloween</strong>.</blockquote><p>You can imagine making a number of these rules for other keywords — <strong>birthday</strong>, <strong>baptism</strong>, <strong>Christmas</strong>, etc… It’s almost like the text lines up one-to-one with the classification. And then we have some words like <strong>spooky</strong> and <strong>costume</strong> that may also map to the <strong>Halloween</strong> category.</p><p>While simple, this kind of rule can be effective for discriminating words that describe certain events well. But this breaks down when we move from primary to secondary or tertiary classifications. For example, “<em>Join us to celebrate Dylan’s 3rd birthday</em>” and “<em>Join us to celebrate Dylan’s 40th birthday</em>” are different events from the perspective of our business (as indicated earlier), and yet this rule wouldn’t know how to classify them at a tertiary level. We need to expand the rule to consider age. Of course, age is a number and it’s not obvious that all numbers are ages. What if we see a number that is a time? Or an address? In addition, not all birthday invitation include the age. Things are getting complication very quickly.</p><p>Let’s take another example: <strong>Weddings</strong>. On it’s face it seems straightforward. If an event contains the word <strong>wedding</strong> then classify as wedding. “<em>Come celebrate Roy and Jenny’s wedding</em>” is clearly wedding related. This would work at the primary level. But what about: “<em>Cocktails and snacks in honor of Roy and Jenny’s big day</em>“. No mention of <strong>wedding</strong> in that one, and in fact it might not even be a wedding, but our simple rule would have missed it completely.</p><p>You can build more and more simple rules to catch extreme cases, but then you’ll be left with a very long list of rules. In addition, you’d be surprised how creative some people are in describing their events. And of course as our terminology changes, you’ll always be playing catch up. Finally, when you have many simple rules, you can end up having a big, opaque, and potentially unintuitive model, which is antithetical to a simple rules-based model. But there’s another problem too.</p><h3>Precision vs Recall</h3><p>Say I stick to the <strong>birthday </strong>rule from above. For all the cards that I end up classifying as a birthday, you can be very confident that they will be related to birthdays. After all, there aren’t many events that include the word <strong>birthday</strong>, and are not actually birthday related! The proportion of the events that I classified as birthdays, and actually are birthdays are called true-positives, or <em>model precision</em>. On the flip side, there are many events that I didn’t classify as birthday but actually are birthday events. This is because they didn’t include the word <strong>birthday</strong>, which is all my simple rule uses. These events that I missed, are called false-negatives, or <em>model</em> <em>recall</em>. This tension between <a href="https://www.wikiwand.com/en/Precision_and_recall">precision and recall</a> is one of the fundamental tensions in classification problems. The more strict I am in my classification rule, the higher my precision but the lower my recall. On the flip side, the more liberal my rules are (i.e. wide net) the worse my precision but the better my recall. No free lunch.</p><p>In addition, a simple rule means that each event can only be labeled as one category. While intuitive, what do we do with events that might be classified as multiple categories? Maybe an organization’s <strong>Winter</strong> <strong>party</strong> is 60% <strong>Christmas party,</strong> 30% <strong>Holiday party</strong> and 10% <strong>Generic Drinks and Snacks</strong>?</p><p>We can say that the usefulness of a simple heuristic is inversely related to the level of granularity that it can accurately classify. All that is to say — heuristics are good for simple categorizations. So how do we balance simplicity with complexity? We can cheat…sort of.</p><h3>Text + Meta data FTW</h3><p>I used a model that’s a combination of text and non-text data (why limit yourself?). As mentioned above, text data includes the text of the event, while non-text data includes things like greeting card vs. RSVP, time of the event (<strong>Mother’s Day</strong> cards and <strong>Thanksgiving</strong> dinner invites occur at distinct times of the year), how many guests are invited (<strong>organizations</strong> vs <strong>personal</strong>), etc… I then took this combination of features and used it as my input to a model that can figure out what’s meaningful and then yields a primary/secondary/tertiary classification along with a confidence score for each event. The higher the score, the more confident the prediction. I’m able to tweak my inputs in order to achieve a higher and higher confidence score and better classification accuracy.</p><p>For the rest of this post however, let’s stick to text based modeling as that’s the more interesting problem to solve.</p><h3>Scary example</h3><p>How would the model make sense of the following event?</p><p>Not an actual user’s event, but very representative of one.</p><p>To the human eye, this is clearly a Halloween party invite. What are the text-based signals (ignore the ghost!)?</p><ul><li><strong>Costume</strong></li><li><strong>Dracula</strong> — not many people are named this</li><li><strong>October</strong> and <strong>31st</strong> — this date is a very strong signal</li><li><strong>Fangs</strong> — this is a rare and odd word to have in a party invitation</li><li><strong><em>9 </em>PM</strong> suggests that it’s likely not a kid’s birthday</li></ul><p>What is the noise?</p><ul><li><strong>Wendy and Jack</strong> are a two names, presumably a couple. Where else do couples show up? Almost exclusively in <strong>wedding</strong> related events.</li><li><strong>Invite</strong> and <strong>you</strong> are words that many RSVP events have.</li><li><strong>Dance</strong> and <strong>party</strong> all show up in<strong> general parties and birthdays </strong>and a slew of other events.</li></ul><p>These noisy terms are not helpful in discriminating between Halloween and non-Halloween, and actually might skew towards <strong>parties</strong> instead of <strong>Halloween</strong>.</p><h3>Not all words are made equal</h3><p>Let’s begin to move away from heuristics. We can see that different words have different importance. For example, <strong>dance</strong> is likely to be highly correlated with the event <strong>generic party</strong> but in the context of the above card, the word <strong>October 31</strong> is probably a more important signal that the event is <strong>Halloween</strong> and not <strong>generic party</strong> because <strong>October 31</strong> is so rarely used in general. So clearly the importance of a word in determining the classification depends on the context of the event.</p><p>We can re-weight word-value based on their importance. Instead seeing if a word exists or not (1 or 0), we apply a weight. This type of weighting scheme — where rare words are worth more — is called <a href="https://www.wikiwand.com/en/Tf%E2%80%93idf">TFIDF</a> (term frequency inverse document frequency). This is a well-studied way of weighing word importance in a group of documents. It’s also a great way to ignore words like <strong>the </strong>and <strong>and</strong>. So specific words can be used as signals. We apply TFIDF to our enter set of words, across all events. This represents our first step away from simple heuristics because TFIDF determines the weights associated with each word.</p><p>But the presence or absence of a single word by itself isn’t enough. We need more words.</p><h3>Bag of Words</h3><p>Implicit in the analysis so far is that prevalence of a specific word or group of words is highly correlated with some type of category (<strong>costume</strong> is correlated with <strong>Halloween</strong>).<strong> <em>The key insight to our model is that words that occur more often together are more likely to be related to each other</em>.</strong> This means that we need to count the frequency of our words (and apply TFIDF) instead of just checking if they exist or not. This intuitive, naive and surprisingly powerful approach is called a <a href="https://www.wikiwand.com/en/Bag-of-words_model">bag-of-words</a> (BOW) model. It’s naive because it doesn’t incorporate context, just words themselves. Yet it has surprisingly good results on classification accuracy (or precision and recall). There do exist algorithms that take context into account (e.g <a href="https://www.wikiwand.com/en/Word2vec">word2vec</a>) but those methods are sometimes overkill and can yield less intuitive results, depending on your problem. In addition, since you have to read through many combinations of words and cross-reference them against each other to determine context, these algorithms become computationally expensive, whereas BOW are based on simple word counts which can be calculated very quickly.</p><p>As mentioned above, the crux of our model is that certain words are associated with certain categories. The algorithm looks at all the words and the events together (forming a big matrix) and applies weights to each word when presented with a new event we want to classify.</p><p>So in the above example, the algorithm would put a lot of weight on words like <strong>October </strong>and<strong> costume</strong><em> </em>and<strong> 9PM</strong>. It figures out the weights using some math and historical data that we fed into it to teach it what Halloween events look like, what weddings look like and what birthdays (kids vs. adults) look like. In this manner, we don’t need to explicitly say <strong>costume</strong> maps to <strong>Halloween</strong>. We hope that the model learns how strong this relationship is after seeing enough examples.</p><h3>Learning Concepts vs. Words</h3><p>So the main input to the model is a big matrix of words and events.</p><p>I highlighted so-called word/event clusters. As mentioned above, some words are more useful than others. For example, <strong>the</strong> isn’t helpful at all, so we use TFIDF to down weight it, effectively ignoring it (by almost zeroing it out).</p><p>We know that some words cluster together — <strong>turkey</strong>, <strong>pumpkin</strong>, <strong>foliage</strong>, <strong>November</strong>. These words are so related that we say they define a <strong>concept</strong>. Let’s call this concept <strong>Thanksgiving</strong>. To reveal these concepts, we can apply <a href="https://www.wikiwand.com/en/Singular-value_decomposition">Singular Value Decomposition</a> (SVD) to the big matrix of word counts. SVD is one of the most widely used techniques in all of numerical analysis. It’s a way to decompose a big matrix into smaller matrices, each one having its own meaning in the context of the problem we’re solving.</p><p>Using SVD on this matrix will essentially convert a lot of words into a few concepts. These concepts, theoretically, will map to the classifications we know — such as <strong>birthday</strong>, <strong>Thanksgiving</strong>, <strong>Halloween</strong>, <strong>Christmas</strong>, etc… Applying SVD to a term/document matrix as above is known as <a href="https://www.wikiwand.com/en/Latent_semantic_analysis">Latent Semantic Analysis</a>. It’s <em>latent</em> because we are picking up latent (or hidden) concepts by clustering words based on how similar their documents are.</p><p>So now we have a method of figuring out concepts. But how can we actually calculate what key concept is inherent in each event? In other words, how can we figure out if the above event is <strong>Halloween</strong> or <strong>Thanksgiving</strong>? The next step in the process is to solve for the weights we apply to each word in the event.</p><h3>On to the math…or not</h3><p>This part of the model is quite simple. Generally speaking, we can write most machine learning problems in the form <strong>Y = X * B</strong>. In this context:</p><ul><li><strong>X</strong> = Our concept/document matrix, after applying TFIDF and SVD</li><li><strong>Y</strong> = The classification of each event (<strong>birthday</strong>, <strong>St. Patrick’s Day</strong>, <strong>bachelor party</strong>, etc…)</li><li><strong>B</strong> = A vector of weights associated with each word</li></ul><p>We know <strong>X</strong> and <strong>Y</strong>, and what we really want to know is <strong>B</strong>. Once we have <strong>B,</strong> then given a bunch of words (e.g. text from a new event), we can apply our weights to each word (via a dot-product) and output a classification (<strong>Y</strong>).</p><p>How exactly we get <strong>B</strong> isn’t all that important for this purpose. There are a number of algorithms we can use — for the record, we’re currently using an ensemble of methods which includes a <a href="https://www.wikiwand.com/en/Logistic_regression">Logistic Regression</a> and <a href="https://www.paperlesspost.com/blog/teams/event-classifier/#">Support Vector Machine</a>. Some algorithms are better suited for this type of problem than others, but the most important factor is: does the model classify well? Does it balance precision and recall? Does it run quickly? If so, then we go ahead and productionalize it. If not, we keep making adjustments until it’s good enough for people to trust and use.</p><h3>Summary</h3><p>We covered a lot above, so here are the highlights:</p><ol><li>Accurately classifying events is useful for our business. The more granular the better — <strong>wedding brunch</strong> vs. <strong>engagement party</strong> is more useful than just <strong>wedding</strong>.</li><li>Using simple heuristics are great for some things that are obvious like <strong>Halloween </strong>but not for others like <strong>holiday party</strong>. You’ll get high precision but low recall.</li><li>Certain words are highly correlated with certain categories. This is the crux of the bag-of-words algorithm and is the key to its simplicity and intuitiveness.</li><li>Instead of telling the model which words to watch out for, we ask the model to tell us which are important and which are not, based on historical data.</li><li>Using SVD, we can learn more than just word associations — we can learn <strong>concepts</strong>, which are clusters of related words. Bonus points: This type of model can think in probabilities instead of binary yes/no.</li><li>Rare words are more important in determining classification than common words, all else being equal. <strong>The</strong> is useless. <strong>Stag</strong> is helpful.</li><li>Context is obviously nice to have, but can be very resource intensive because you need a lot of data. Sometimes word counts alone are sufficient for a good, working model, supplemented by meta data.</li><li><strong>Y = X * B</strong> is a very common way to think about machine learning tasks. There are many techniques to figure out <strong>B</strong> and it’s important to understand what they do and when to use which technique. But in general, algorithm choice — while the most mathematically and computationally intensive part of the process — is not nearly as important to solving the overall task as a thoughtful, holistic model building approach.</li></ol><p>And that in a nutshell is how I built (and continue to maintain and improve) Paperless Post’s event classifier! Feel free to drop me an email @ <strong>iman@paperlesspost.com</strong>.</p><p><em>Originally published at </em><a href="https://www.paperlesspost.com/blog/teams/event-classifier/"><em>www.paperlesspost.com</em></a><em> on November 6, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c3b9a862f46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/the-event-classifier-paperless-post-team-blog-7c3b9a862f46">The Event Classifier — Paperless Post Team Blog</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Event Classifier — Paperless Post Team Blog]]></title>
            <link>https://medium.com/@LifeAtPaperless/the-event-classifier-paperless-post-team-blog-d40664ca3c4e?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d40664ca3c4e</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Mon, 06 Nov 2017 15:48:39 GMT</pubDate>
            <atom:updated>2019-01-22T17:07:52.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Event Classifier — Paperless Post Team Blog</h3><p>November 6, 2017 by Ilan Man</p><p>Paperless Post allows you to send invitations to events (“RSVPs”) and greeting cards (“cards”). Examples of RSVPs include weddings, company holiday parties and baptisms, to name a few. Cards include birthday greetings and Mother’s Day well wishes. It’s critical for us as a business to understand how to classify these events so that we can make better informed business decisions. We don’t ask people what they’re creating because we want them to have the easiest possible user flow. That said, it’s helpful for us know what people are using our service for so we can improve it.</p><p>Today we’re going to better understand how exactly we classify greeting cards and events (hereafter simply referred to as “events”) at Paperless Post. We’ll review:</p><ul><li>How we think about event classifications</li><li>Complexities around text-based classification</li><li>Ways to understand if our classifier is good or not</li><li>Key aspects of our model</li></ul><h3>Categorizing events</h3><p>It’s important for us to know if a birthday party is for a 5 year old or a 55 year old. These are two different demographics which require different marketing strategies and different card designs, among other things. However it’s also important to distinguish between birthday parties and Christmas parties. As a result, we decided on a parent/child hierarchy for classifying events. At the top (primary level) are high level categorizations, such as <strong>birthday</strong>, <strong>wedding</strong>, <strong>personal</strong>, etc… Within each one of these lives a secondary classification — <strong>kids birthday </strong>vs<strong> adult birthday</strong> or <strong>wedding showers </strong>vs <strong>save the date</strong>. Finally, within each secondary category exists a tertiary category. Tertiary examples are <strong>baby shower</strong> vs <strong>teenage birthday </strong>vs <strong>tween birthday</strong> or <strong>wedding save the date</strong> vs <strong>engagement save the date</strong>. As you might imagine, classifying at the primary level is much more straightforward than the tertiary level. For one, there are fewer categories, so inherently fewer potential mistakes. In addition, it’s easier to distinguish between <strong>birthday</strong> and <strong>wedding</strong>. However, things get hairy at the secondary and tertiary level, which is why we need to build a model. For the purposes of this post, we’ll focus on the tertiary classification since that’s more interesting and generalizes to secondary and primary. Before diving into the model however, let’s try to solve this problem using simple heuristics.</p><h3>Heuristics and Nuance</h3><p>The crux of our classification algorithm is that it combs through the text of a user’s event and identifies key words that are used to correctly classify it. Simple enough. So to begin, let’s make a rule:</p><blockquote>If the term <strong>Halloween</strong> exists in the text of the event, then assign that event to the tertiary category <strong>Halloween</strong>.</blockquote><p>You can imagine making a number of these rules for other keywords — <strong>birthday</strong>, <strong>baptism</strong>, <strong>Christmas</strong>, etc… It’s almost like the text lines up one-to-one with the classification. And then we have some words like <strong>spooky</strong> and <strong>costume</strong> that may also map to the <strong>Halloween</strong> category.</p><p>While simple, this kind of rule can be effective for discriminating words that describe certain events well. But this breaks down when we move from primary to secondary or tertiary classifications. For example, “<em>Join us to celebrate Dylan’s 3rd birthday</em>” and “<em>Join us to celebrate Dylan’s 40th birthday</em>” are different events from the perspective of our business (as indicated earlier), and yet this rule wouldn’t know how to classify them at a tertiary level. We need to expand the rule to consider age. Of course, age is a number and it’s not obvious that all numbers are ages. What if we see a number that is a time? Or an address? In addition, not all birthday invitation include the age. Things are getting complication very quickly.</p><p>Let’s take another example: <strong>Weddings</strong>. On it’s face it seems straightforward. If an event contains the word <strong>wedding</strong> then classify as wedding. “<em>Come celebrate Roy and Jenny’s wedding</em>” is clearly wedding related. This would work at the primary level. But what about: “<em>Cocktails and snacks in honor of Roy and Jenny’s big day</em>“. No mention of <strong>wedding</strong> in that one, and in fact it might not even be a wedding, but our simple rule would have missed it completely.</p><p>You can build more and more simple rules to catch extreme cases, but then you’ll be left with a very long list of rules. In addition, you’d be surprised how creative some people are in describing their events. And of course as our terminology changes, you’ll always be playing catch up. Finally, when you have many simple rules, you can end up having a big, opaque, and potentially unintuitive model, which is antithetical to a simple rules-based model. But there’s another problem too.</p><h3>Precision vs Recall</h3><p>Say I stick to the <strong>birthday </strong>rule from above. For all the cards that I end up classifying as a birthday, you can be very confident that they will be related to birthdays. After all, there aren’t many events that include the word <strong>birthday</strong>, and are not actually birthday related! The proportion of the events that I classified as birthdays, and actually are birthdays are called true-positives, or <em>model precision</em>. On the flip side, there are many events that I didn’t classify as birthday but actually are birthday events. This is because they didn’t include the word <strong>birthday</strong>, which is all my simple rule uses. These events that I missed, are called false-negatives, or <em>model</em> <em>recall</em>. This tension between <a href="https://www.wikiwand.com/en/Precision_and_recall">precision and recall</a> is one of the fundamental tensions in classification problems. The more strict I am in my classification rule, the higher my precision but the lower my recall. On the flip side, the more liberal my rules are (i.e. wide net) the worse my precision but the better my recall. No free lunch.</p><p>In addition, a simple rule means that each event can only be labeled as one category. While intuitive, what do we do with events that might be classified as multiple categories? Maybe an organization’s <strong>Winter</strong> <strong>party</strong> is 60% <strong>Christmas party,</strong> 30% <strong>Holiday party</strong> and 10% <strong>Generic Drinks and Snacks</strong>?</p><p>We can say that the usefulness of a simple heuristic is inversely related to the level of granularity that it can accurately classify. All that is to say — heuristics are good for simple categorizations. So how do we balance simplicity with complexity? We can cheat…sort of.</p><h3>Text + Meta data FTW</h3><p>I used a model that’s a combination of text and non-text data (why limit yourself?). As mentioned above, text data includes the text of the event, while non-text data includes things like greeting card vs. RSVP, time of the event (<strong>Mother’s Day</strong> cards and <strong>Thanksgiving</strong> dinner invites occur at distinct times of the year), how many guests are invited (<strong>organizations</strong> vs <strong>personal</strong>), etc… I then took this combination of features and used it as my input to a model that can figure out what’s meaningful and then yields a primary/secondary/tertiary classification along with a confidence score for each event. The higher the score, the more confident the prediction. I’m able to tweak my inputs in order to achieve a higher and higher confidence score and better classification accuracy.</p><p>For the rest of this post however, let’s stick to text based modeling as that’s the more interesting problem to solve.</p><h3>Scary example</h3><p>How would the model make sense of the following event?</p><p>Not an actual user’s event, but very representative of one.</p><p>To the human eye, this is clearly a Halloween party invite. What are the text-based signals (ignore the ghost!)?</p><ul><li><strong>Costume</strong></li><li><strong>Dracula</strong> — not many people are named this</li><li><strong>October</strong> and <strong>31st</strong> — this date is a very strong signal</li><li><strong>Fangs</strong> — this is a rare and odd word to have in a party invitation</li><li><strong><em>9 </em>PM</strong> suggests that it’s likely not a kid’s birthday</li></ul><p>What is the noise?</p><ul><li><strong>Wendy and Jack</strong> are a two names, presumably a couple. Where else do couples show up? Almost exclusively in <strong>wedding</strong> related events.</li><li><strong>Invite</strong> and <strong>you</strong> are words that many RSVP events have.</li><li><strong>Dance</strong> and <strong>party</strong> all show up in<strong> general parties and birthdays </strong>and a slew of other events.</li></ul><p>These noisy terms are not helpful in discriminating between Halloween and non-Halloween, and actually might skew towards <strong>parties</strong> instead of <strong>Halloween</strong>.</p><h3>Not all words are made equal</h3><p>Let’s begin to move away from heuristics. We can see that different words have different importance. For example, <strong>dance</strong> is likely to be highly correlated with the event <strong>generic party</strong> but in the context of the above card, the word <strong>October 31</strong> is probably a more important signal that the event is <strong>Halloween</strong> and not <strong>generic party</strong> because <strong>October 31</strong> is so rarely used in general. So clearly the importance of a word in determining the classification depends on the context of the event.</p><p>We can re-weight word-value based on their importance. Instead seeing if a word exists or not (1 or 0), we apply a weight. This type of weighting scheme — where rare words are worth more — is called <a href="https://www.wikiwand.com/en/Tf%E2%80%93idf">TFIDF</a> (term frequency inverse document frequency). This is a well-studied way of weighing word importance in a group of documents. It’s also a great way to ignore words like <strong>the </strong>and <strong>and</strong>. So specific words can be used as signals. We apply TFIDF to our enter set of words, across all events. This represents our first step away from simple heuristics because TFIDF determines the weights associated with each word.</p><p>But the presence or absence of a single word by itself isn’t enough. We need more words.</p><h3>Bag of Words</h3><p>Implicit in the analysis so far is that prevalence of a specific word or group of words is highly correlated with some type of category (<strong>costume</strong> is correlated with <strong>Halloween</strong>).<strong> <em>The key insight to our model is that words that occur more often together are more likely to be related to each other</em>.</strong> This means that we need to count the frequency of our words (and apply TFIDF) instead of just checking if they exist or not. This intuitive, naive and surprisingly powerful approach is called a <a href="https://www.wikiwand.com/en/Bag-of-words_model">bag-of-words</a> (BOW) model. It’s naive because it doesn’t incorporate context, just words themselves. Yet it has surprisingly good results on classification accuracy (or precision and recall). There do exist algorithms that take context into account (e.g <a href="https://www.wikiwand.com/en/Word2vec">word2vec</a>) but those methods are sometimes overkill and can yield less intuitive results, depending on your problem. In addition, since you have to read through many combinations of words and cross-reference them against each other to determine context, these algorithms become computationally expensive, whereas BOW are based on simple word counts which can be calculated very quickly.</p><p>As mentioned above, the crux of our model is that certain words are associated with certain categories. The algorithm looks at all the words and the events together (forming a big matrix) and applies weights to each word when presented with a new event we want to classify.</p><p>So in the above example, the algorithm would put a lot of weight on words like <strong>October </strong>and<strong> costume</strong><em> </em>and<strong> 9PM</strong>. It figures out the weights using some math and historical data that we fed into it to teach it what Halloween events look like, what weddings look like and what birthdays (kids vs. adults) look like. In this manner, we don’t need to explicitly say <strong>costume</strong> maps to <strong>Halloween</strong>. We hope that the model learns how strong this relationship is after seeing enough examples.</p><h3>Learning Concepts vs. Words</h3><p>So the main input to the model is a big matrix of words and events.</p><p>I highlighted so-called word/event clusters. As mentioned above, some words are more useful than others. For example, <strong>the</strong> isn’t helpful at all, so we use TFIDF to down weight it, effectively ignoring it (by almost zeroing it out).</p><p>We know that some words cluster together — <strong>turkey</strong>, <strong>pumpkin</strong>, <strong>foliage</strong>, <strong>November</strong>. These words are so related that we say they define a <strong>concept</strong>. Let’s call this concept <strong>Thanksgiving</strong>. To reveal these concepts, we can apply <a href="https://www.wikiwand.com/en/Singular-value_decomposition">Singular Value Decomposition</a> (SVD) to the big matrix of word counts. SVD is one of the most widely used techniques in all of numerical analysis. It’s a way to decompose a big matrix into smaller matrices, each one having its own meaning in the context of the problem we’re solving.</p><p>Using SVD on this matrix will essentially convert a lot of words into a few concepts. These concepts, theoretically, will map to the classifications we know — such as <strong>birthday</strong>, <strong>Thanksgiving</strong>, <strong>Halloween</strong>, <strong>Christmas</strong>, etc… Applying SVD to a term/document matrix as above is known as <a href="https://www.wikiwand.com/en/Latent_semantic_analysis">Latent Semantic Analysis</a>. It’s <em>latent</em> because we are picking up latent (or hidden) concepts by clustering words based on how similar their documents are.</p><p>So now we have a method of figuring out concepts. But how can we actually calculate what key concept is inherent in each event? In other words, how can we figure out if the above event is <strong>Halloween</strong> or <strong>Thanksgiving</strong>? The next step in the process is to solve for the weights we apply to each word in the event.</p><h3>On to the math…or not</h3><p>This part of the model is quite simple. Generally speaking, we can write most machine learning problems in the form <strong>Y = X * B</strong>. In this context:</p><ul><li><strong>X</strong> = Our concept/document matrix, after applying TFIDF and SVD</li><li><strong>Y</strong> = The classification of each event (<strong>birthday</strong>, <strong>St. Patrick’s Day</strong>, <strong>bachelor party</strong>, etc…)</li><li><strong>B</strong> = A vector of weights associated with each word</li></ul><p>We know <strong>X</strong> and <strong>Y</strong>, and what we really want to know is <strong>B</strong>. Once we have <strong>B,</strong> then given a bunch of words (e.g. text from a new event), we can apply our weights to each word (via a dot-product) and output a classification (<strong>Y</strong>).</p><p>How exactly we get <strong>B</strong> isn’t all that important for this purpose. There are a number of algorithms we can use — for the record, we’re currently using an ensemble of methods which includes a <a href="https://www.wikiwand.com/en/Logistic_regression">Logistic Regression</a> and <a href="https://www.paperlesspost.com/blog/teams/event-classifier/#">Support Vector Machine</a>. Some algorithms are better suited for this type of problem than others, but the most important factor is: does the model classify well? Does it balance precision and recall? Does it run quickly? If so, then we go ahead and productionalize it. If not, we keep making adjustments until it’s good enough for people to trust and use.</p><h3>Summary</h3><p>We covered a lot above, so here are the highlights:</p><ol><li>Accurately classifying events is useful for our business. The more granular the better — <strong>wedding brunch</strong> vs. <strong>engagement party</strong> is more useful than just <strong>wedding</strong>.</li><li>Using simple heuristics are great for some things that are obvious like <strong>Halloween </strong>but not for others like <strong>holiday party</strong>. You’ll get high precision but low recall.</li><li>Certain words are highly correlated with certain categories. This is the crux of the bag-of-words algorithm and is the key to its simplicity and intuitiveness.</li><li>Instead of telling the model which words to watch out for, we ask the model to tell us which are important and which are not, based on historical data.</li><li>Using SVD, we can learn more than just word associations — we can learn <strong>concepts</strong>, which are clusters of related words. Bonus points: This type of model can think in probabilities instead of binary yes/no.</li><li>Rare words are more important in determining classification than common words, all else being equal. <strong>The</strong> is useless. <strong>Stag</strong> is helpful.</li><li>Context is obviously nice to have, but can be very resource intensive because you need a lot of data. Sometimes word counts alone are sufficient for a good, working model, supplemented by meta data.</li><li><strong>Y = X * B</strong> is a very common way to think about machine learning tasks. There are many techniques to figure out <strong>B</strong> and it’s important to understand what they do and when to use which technique. But in general, algorithm choice — while the most mathematically and computationally intensive part of the process — is not nearly as important to solving the overall task as a thoughtful, holistic model building approach.</li></ol><p>And that in a nutshell is how I built (and continue to maintain and improve) Paperless Post’s event classifier! Feel free to drop me an email @ <strong>iman@paperlesspost.com</strong>.</p><p><em>Originally published at </em><a href="https://www.paperlesspost.com/blog/teams/event-classifier/"><em>www.paperlesspost.com</em></a><em> on November 6, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d40664ca3c4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SMART* Testing — QA]]></title>
            <link>https://medium.com/life-at-paperless/smart-testing-qa-ebbe0eddf77?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebbe0eddf77</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 17:00:13 GMT</pubDate>
            <atom:updated>2019-06-10T20:09:41.741Z</atom:updated>
            <content:encoded><![CDATA[<p>August 3, 2017 by Riddhi Ekbote</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5-AL-q2KEa6LF1iytX5-Q.jpeg" /></figure><p>After speaking in a 99 seconds talk in a QA Conference, I decided to write a blog on the SMART* testing strategy I discussed there. As a QA Engineer I have learned and used different traditional testing strategies, but I realized each one has its limitations. Combining these testing strategies to test a given story or a feature can create test redundancy and shift focus.</p><p>We talk about having quality over quantity, but we might not always apply this while testing a feature story. We end up putting more “quantity” of testing hours to gain more “quality”. This might be a good approach but not an efficient one.</p><p>After considering the strengths and weaknesses of the different strategies, I explored and experimented with a hybrid testing technique. It will save time and still retains the quality of the feature deliverable, which I call <em>SMART* testing.</em></p><p><em>SMART* Testing</em> gives an individual feature its own testing strategy. SMART* testing accompanied with Feature testing will help deliver healthy features to the customers.</p><h3>What is SMART*?</h3><p>S M A R T in Product terminology is (Specific, Measurable, Achievable, Relevant, Time- oriented) But in testing, I classify it as</p><p><em>S — </em>Smoke testing</p><p><em>M — </em>Most Important workflows<br> <em>A — </em>Application of Knowledge<br> <em>R — </em>Relevant Regression | Running Automation tests<br> <em>T — </em>Tree-structure Testing<br> <em>* </em>— for experienced QA testers/engineers.<br> SMART* tests are more suitable for the testers who have experience in the company, know the company goals and have knowledge about the product.</p><p>Before going through S.M.A.R.T. in brief, please remember SMART* testing is not a replacement to Feature testing. I’ve included examples of use cases from my time at Paperless Post after each definition.</p><p><strong><em>S — Smoke testing </em></strong>— is preliminary testing to reveal simple failures severe enough to reject a story/feature.<br> <em>Examples of small but crucial functions :</em> login &amp; signup, search engine.</p><p><strong><em>M — Most important workflow </em></strong>— Validate start-to-finish, real world scenarios and workflows to expose failures. This prevents adverse effects on customer interactions and checkout experience.<br> <em>Examples of important workflows, on which a company’s revenue is dependent are :</em> sending invites, placing orders, receiving order emails, uploading photos.</p><p><strong><em>A — Application knowledge </em>— </strong>In this step, knowledge about the product plays an important role in validating the feature story. We all know and have experienced bugs cropping up in different areas of the software that we hardly anticipate. Acquiring the software architecture and institutional knowledge can help build up our testing strategy which uncovers these unexpected bugs.</p><p><em>Example:</em> If there are changes made to the pricing model, along with verifying the checkout workflow, testing other areas of the site affected by this change like search pages, user-events, CMS-admin tool, OMS-tool and iOS app are considered as application of knowledge.</p><p><strong><em>R — Relevant regression </em></strong>— it’s a subset of regression testing. Both manual and automation testing can be performed in this step. Performing regression on a specific application that surrounds the feature story could be enough rather than performing unnecessary regression on the entire application. This can help move the features out the door faster with quality and integrity.</p><p><em>Example:</em> On a feature story to add photos on the back of paper cards, along with feature testing, a regression testing was performed on the existing application which included: (a) Verifying whether feature is not available on cards in online mode. (b) Verifying cloning from Paper to online card does not carry over the photos on the back of the cards. © Verifying switching card designs does not affect the position of the photos on the cards.</p><p>(d) Looking through the application code in the repo confirmed that regression testing on envelopes was not needed.</p><p><strong><em>T — Tree structure testing </em></strong>— Tree analogies in software systems are a familiar topic. A large website is typically organized into a hierarchy (a “tree”) of features, sub features, and their dependencies. Tree-structure testing is different from bottom-up or top-down testing, in that it’s about testing the root feature and its branches. Mind mapping a feature can help expose relationships amongst functionalities of an application.</p><p><em>Example:</em></p><p>To conclude, SMART* testing gives you the liberty to put your knowledge to practice and helps gain confidence in your testing strategy. There are no fixed rules in SMART* testing standards. It is flexible based on the scope of the feature (frontend / backend), which gives the tester flexibility to optimize their testing process.</p><p>I have had great experiences exploring this strategy and signing off on releases and feature stories with quality and confidence. Refining and improvising SMART* tests will be an on-going learning process for me.</p><p><em>Thanks,</em><br> <em>Riddhi E (</em><a href="https://www.linkedin.com/in/riddhi-ekbote/"><em>LinkedIn</em></a><em>)</em><br> <em>[QA Engineer — </em><a href="https://www.paperlesspost.com/"><em>Paperless Post</em></a><em>, NYC]</em></p><p><em>Originally published at </em><a href="https://www.paperlesspost.com/blog/teams/smart-testing/"><em>www.paperlesspost.com</em></a><em> on August 3, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebbe0eddf77" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/smart-testing-qa-ebbe0eddf77">SMART* Testing — QA</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paperless Post’s Infrastructure as Code Journey at Automacon.io]]></title>
            <link>https://medium.com/life-at-paperless/paperless-posts-infrastructure-as-code-journey-at-automacon-io-e177673eaf8c?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e177673eaf8c</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Mon, 07 Nov 2016 16:36:06 GMT</pubDate>
            <atom:updated>2019-06-10T20:10:29.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZEwi0_yIpgkQZhlTsijtA.jpeg" /></figure><p>A few weeks ago I had the pleasure of attending and presenting at <a href="http://automacon.io/">Automacon</a>, the Infrastructure as Code Conference in Portland, Oregon. The conference itself was an incredible experience: well-curated, well-run, well-catered, and well-cultured. I found inspiration in the presentations, the many meaningful conversations I had with the other attendees, and especially the after hours friends-and-family tour of the Portland Art Museum.</p><p>The topic of my talk was Paperless Post’s infrastructure-as-code history, starting from when we were a humble startup with no operations team. In my talk I examine the tools we used, the hardships we overcame, and the lessons we learned along the way. Check out the video here to learn a bit about how we went from having a few servers held together with hopes and dreams to our present day orchestration with Terraform, Docker, Chef, Amazon Web Services, and custom-built tools.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5KJCshEmeHE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5KJCshEmeHE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5KJCshEmeHE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ee16d799478e80f5cd4b2742e5a8a20/href">https://medium.com/media/2ee16d799478e80f5cd4b2742e5a8a20/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e177673eaf8c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/paperless-posts-infrastructure-as-code-journey-at-automacon-io-e177673eaf8c">Paperless Post’s Infrastructure as Code Journey at Automacon.io</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intern Recap Summer 2016]]></title>
            <link>https://medium.com/life-at-paperless/intern-recap-summer-2016-d8ed0f80c50d?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8ed0f80c50d</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Mon, 29 Aug 2016 14:23:59 GMT</pubDate>
            <atom:updated>2019-06-10T20:11:02.806Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T07zOzUU7hL7lUkKmGe2yw.jpeg" /></figure><p>Each summer, Paperless Post welcomes interns to join our engineering team! Our interns come from all over and have different interests but all are excited to work at a tech company and get their code into production. They go through an intensive education program consisting of workshops, meeting with all the teams, lunches, and hack days, but spend most of their time developing code.</p><p>Each intern works on a substantial project and as the program is nearing the end, we wanted to share some thoughts on their experiences! We really appreciate their hard work.</p><h4>Iris</h4><p>I’m Iris, currently getting my Master’s in CS at Columbia University. My passions lie in mobile technologies, game development, and improving my programming skills as a craft. As I wrap up my last week at Paperless Post as an iOS intern, I wanted to reflect on this summer and offer some advice to incoming interns.</p><p>First off, try to gauge your own expectations as well as the organization’s you’re joining before diving in. I had just finished up half my credits at Columbia and felt like I had a thorough background in Operating Systems, algorithm analysis, compilers, and language design. I had also spent the past two years at a small start-up creating educational mobile games while being exposed to two different 2D tools for game-making, both for mobile. While I felt comfortable enough with iOS’s tools, such as Xcode, I had never been exposed to UIKit and Apple’s more well-known framework for creating apps. Paperless Post seemed the perfect organization for someone like me who desired to learn a new technology while also craving the structure and processes of a more established start-up. Knowing ahead that our needs aligned allowed me to identify concrete goals for the breadth and scope of my work from the beginning.</p><p>The first week I met a lot of new people and was exposed to new ways of doing things. For someone more introverted, it can feel draining. If, like me, you’ve never used tools like JIRA for Agile and an established Gitflow for formalizing tasks, you might have to go through an adjustment period. When I joined, there was one other intern who had already been there for a month and seemed to be shipping tickets like no big deal. I would resist the urge to jump right in; shipping my first ticket felt amazing until I realized I had messed up our team’s Git history. But also don’t let the fear of making mistakes hold you back — the entire organization is super supportive and geared towards helping people grow.</p><p>After a couple of weeks flew by, I saw the value in the many processes in place. Daily stand-ups and a storyboard for referral never had me asking “What am I supposed to be doing right now?” Everyone’s role on the team was so seamlessly integrated with our automated processes. I knew that I had to update my JIRA tickets for the QA Tester before shipping code, and talk to the Product Manager before making any UI changes. We smoothed over any rough edges during sprint retros or over Slack. For the first time I really felt like part of a well-oiled, fully-functioning technical team. I felt super grateful that I was able to be a part of it for three months, and that I will carry this experience with me wherever I end up.</p><p>Don’t forget to let loose and have fun during an internship as well. I’m lucky that Paperless has a great culture of throwing Thirsty Thursdays, sponsoring cross-team lunches, and even hosting an internal hackathon, Stampy Day. To the best of your ability, try to participate in extra events, meet new people, and explore New York. If you’re lucky enough to be interning at Paperless Post, make the most out of it.</p><h4>Si Te</h4><p>Hello world, my name is Si Te, and I am currently a 4th year Mechatronics Engineering student studying at the University of Waterloo, Canada. This blog was written at the end of my summer 2016 internship summarizing my experience in the city working as an iOS developer at Paperless Post.</p><p>Working at Paperless Post in New York City was a pleasure because of the friendly working environment, the summer activities around and within the city, and fun company events. The company has a clear focus on fostering consumer self-expression by providing tools and photorealistic visuals to help customers create personalized cards. In addition, the way that Paperless Post approaches a software product could be described with Steve Job’s words: “at the intersection between technology and humanities.” In my opinion, the focus on the human aspect of the product is what sets Paperless Post apart from its competitors. The human aspect includes everything from the texture of the paper to hand-painted cards to the prompt email reminders that help the event hosts to prepare. By the end of the first month working here, it was evident that many features on a similar software product, Evite, were inspired by Paperless Post, but because the focus of Evite was misdirected, they could only copy the form, not the soul of Paperless Post.</p><p>The excitement of working at Paperless Post is being a part of a company that combines the spirit of Silicon Valley and merging it with the arts in a masterful way that few other companies could achieve. As an intern working on the iOS team from May to August 2016, I’ve seen this first-hand. The iOS team distills the core spirit of the company in an iOS app, albeit missing some features that exist on the desktop counterpart. This means that as an iOS developer intern on the iOS team, I got the chance to work on many types of things, ranging from on-boarding to invitation delivery. The developers work closely with the product manager, the quality assurance, and UI/UX designers to ensure the final product works seamlessly. For each new feature planned, there would be around two meetings with all members on the team brainstorming new features or commenting/critiquing on the existing plan. Interns were fully involved in these discussions and were certainly encouraged to suggest new ideas or voice concerns. Thanks to these in-depth product or technical meetings, the Paperless Post iOS team is able to produce a user-friendly app that is well-thought-out with useful features.</p><p>The iOS team is also constantly striving to be better. Every two weeks the team will do a Sprint Retrospective that reflects on the performance of the team in the past sprint. Members on the team were not shy from writing down all the things that the team has done well and not well. These kinds of open communication really helped the team to improve. The shorter technical version of the Sprint Retro is code review. The team members were very thorough in code reviews, and taught me a considerable amount of Swift that I didn’t know before. To further promote the quality of code, there was a guideline put in place explaining the correct syntax of the Swift language, while continuous integration tests made sure that a merge into master branch was always passing all the unit tests.</p><p>Stampy Day at Paperless Post is a tradition where everyone in the company is given two and a half days to work on any project that they think will benefit the company but didn’t have the time to work on. This was yet another opportunity for interns like me to show a new idea. For this term, I’ve worked on a card recommendation engine using a basic artificial neural network. I’m thankful have gotten help from co-workers when trying to gather card data. Although the end product didn’t work as well as I initially hoped, the process of writing code on something that I was very passionate about was very fulfilling.</p><p>Working at Paperless Post in the Big Apple has expanded my experience considerably. Weekends in the city are always enjoyable with lots of things to do. The 40 minute commute to work has also been strangely helpful because I was able to read articles and books on the train that I wouldn’t have otherwise read. The combination of all the great things about this internship has made the summer feel short. It was a great pleasure to intern at Paperless Post. The most memorable lesson learned for me was when looking for summer New York housing, find a room with air conditioning.</p><h4>Koko</h4><p>Hi! I’m Koko Nakajima, a rising junior studying computer science at Brown University. This summer, I’ve been working with the Styles team at Paperless Post as a product design intern.</p><p>The Styles team (as its name might suggest) works to ensure that visual styles are consistent across all aspects of the Paperless Post experience. The team maintains a living style guide with UI components and design patterns, for both developers and designers to reference in their work.</p><p>I spent most of my summer working on a redesign of the Post Box — where users can view all the cards they’ve ever sent, scheduled, received, drafted, archived, or trashed. Initially, my task was to reskin the Post Box using our current styles. This area of the website hadn’t been updated for a while, and was in fact several generations of styles old. It quickly became apparent that there were many design improvements that could be made, from both a visual design and product design standpoint. Several stakeholders suggested that this might be a good opportunity to rethink the entire architecture of the Post Box. Under the guidance of my mentor, I developed designs for a new, restructured Post Box to better address common use cases and reflect up-to-date styles. I began with wireframes to demonstrate the general structure of the pages:</p><p>Then, I proceeded to fine-tune the visual design details, while fleshing out the more granular information architecture.</p><p>Other, smaller projects I contributed to over the summer involved tasks like re-skinning the Paperless Post team blogs or improving the usability of the UI kit Sketch files for designers.</p><p>The projects I worked on allowed me to explore many facets of product design, from user research to wireframing to speaking with stakeholders. I also received invaluable feedback and advice from many of the other product designers, who had tackled similar problems in the past. It was interesting to see how product designers worked with people like developers and content designers; as a student, I often find it difficult to consider design in the larger context of a team or product. Here, the design and development processes seem to intersect and inform one another quite frequently.</p><p>At Paperless Post, I was constantly surrounded by people who fostered a culture of collaboration and encouragement. I can say that the collective enthusiasm for learning contributed to a fantastic intern experience.</p><h4>Tony</h4><p>Hey! I’m Tony and I want to share my experience interning at Paperless Post. A little bit about myself first: I just graduated from RIT with my MS in Human-Computer Interaction, and I’ve been focusing a lot on the front-end aspect of web development. I’ll try to give you more insight about the internship program at Paperless and why I think it is a great company!</p><p>First of all, you will work in stuff that is relevant to you and will make you challenge yourself. As a developer who focuses mostly on the front-end, I was accepted into the Events team, which holds a large chunk of user-facing features of the site. For me this was very exciting, since I was able to work with the features that have an opportunity to make a long-lasting impact on first-time receivers.</p><p>Within the first week, I was attending all of the team meetings. Our PM made sure the whole team knew what our long-term goals were, so when I was working on a feature it wasn’t just coding, it was working on the small features that would get us to where we wanted to be as a team and as a company. The strong focus on A/B testing gives us a lot of insight on what our users like and what they don’t, and enables us to tailor our site to match our users’ expectations.</p><p>When I noticed that a feature that I could implement within a two-week sprint had the potential to cause so much impact in user engagement, it felt awesome. Unlike other companies where interns are given a side project, here at Paperless you will be working on the main product with the team, as well as sitting with them, attending meetings with them, and even having beer with them!</p><p>Everyone in the company is very supportive and fun. In the time I’ve been here, someone has asked me how my internship was going at least once a week. You will meet a lot of smart people and you’ll be able to experience the company culture right away.</p><p>This is the first time that I’ve been part of a truly agile team. We have two-week sprints in which we do our best to push the most relevant stories to production, and at the end of those we do a recap and identify areas of improvement, including what failed and what we should keep doing. I witnessed how the team was able to change the workflow in small ways that would make us more efficient as a whole, and knowing that everyone has the same focus on moving stuff forward makes you feel like you have your entire team backing you up.</p><p>During my internship I worked on some really interesting projects. The biggest was an overhaul to the Delivery and Tracking page, in which I had to update the styles and fonts to match the style guide that the whole company follows on the site. At first I thought this would be simple, but it really took some time and reviewing to finally get it right. As a front-end intern, I was working closely with my team’s Product Designer, and we made sure that the feature was pixel-perfect at the moment of shipping it. It did take some iterations on our end to finally make it right, but when I saw the final result it was totally worth it.</p><p>Another project was replacing all usages of an open source library that wasn’t performing too well. I had to come up with a solution that was more efficient than the library we were using, and that had a programmer-friendly API so that everyone could easily start using it. I took an approach of benchmarking the old library’s performance and then running those tests across two prototypes that I had made for the new utility function. We were able to go from a fairly small library (~150 lines of code) to a 3 line function that outperformed the previous library while also covering all of our use cases and exposing a fairly straightforward API. It was really nice to see members from other teams jumping into my PR, commenting about different approaches that we could take and giving recommendations.</p><p>One thing that you will love about Paperless is that, despite having a fairly large number of employees at the time of this writing (160+), they keep the startup mentality. There’s a “work hard, play hard” attitude in the company, and this is really evident, especially during the summer. With countless activities from company lunches and team outings to Thirsty Thursdays and Summer Fridays, they make sure that you understand what it really means to be part of the company and that you’re enjoying your time here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8ed0f80c50d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/intern-recap-summer-2016-d8ed0f80c50d">Intern Recap Summer 2016</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I tracked down a flaky test]]></title>
            <link>https://medium.com/life-at-paperless/how-i-tracked-down-a-flaky-test-fc76e78c44a3?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc76e78c44a3</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[flaky-tests]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Wed, 27 Jul 2016 17:16:41 GMT</pubDate>
            <atom:updated>2019-06-10T20:12:15.327Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eM0kTw_7Iz5v6m1qhiokIQ.gif" /></figure><p>TLDR: I had trouble figuring out the root cause of a flaky test. I made several theories and used lots of logging to debug the issue. It turns out that this flake only occurs when 4 test files run in a specific order. The issue was that global state was leaking through each test run from improper use of Timecop.</p><h4><strong>What Is A Flaky Test And Why Do We Care?</strong></h4><p>Testing is an important aspect of software development. Tests are used to prevent regressions and allow developers to refactor code with confidence. It’s particularly helpful to run these tests continuously, especially if the tests take more than a couple of minutes to run. At Paperless Post, our unit test suite takes about 5 minutes to complete so we run them on our continuous integration server: Jenkins, which runs these builds on every commit that gets pushed.</p><p>We noticed that some builds initially fail, but pass when they are rebuilt. And when we run the exact same test locally, it always passes. This is not a good sign; these are the symptoms of flaky tests. Unlike many bugs, flaky tests are really hard to fix because they’re so hard to reproduce.</p><p>One option to address this is to simply ignore these failures, but this is not a good practice. Developers will start lose trust in the tests and will begin to ignore failed builds without looking at the specific failures. Even if all the developers are disciplined enough to look at each failed build, they have to look at the build report to determine whether or not the build failed as a result of a real bug or a flake. This behavior is described in the <a href="https://en.wikipedia.org/wiki/Broken_windows_theory">broken windows theory</a>. Sooner or later, our test suite will accumulate more and more flakes to a point where the tests are not useful or beneficial anymore. So, I decided to jump in and try to determine the root cause of this issue. The following is a recount of my journey.</p><h4><strong>Reconnaissance</strong></h4><p>First, let’s take a look at the test failure. In this test, we are trying to render a view by doing a GET request. More specifically, we are rendering the cart modal. This is the failure:</p><pre>1) Error:<br>CartsControllerTest#renders_cart_modal<br>ActionView::TemplateError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id<br>   On line #50 of app/views/carts/_cart_modal.html.haml</pre><pre>48:           - if current_cart.has_print_orders?<br>   49:             - current_cart.print_orders.each do |print_order|<br>   50:               = print_order.related_event.id.to_param</pre><pre>The exception is coming from the fact that print_order.related_event is returning nil. We want to understand why it&#39;s returning a nil value but we don&#39;t have the luxury of inspecting the failed test run interactively. Instead, we have to do detective work. We have to gather some clues about the state of the process at the time of the failure. Let&#39;s start by stating the facts. What can we say is true about the system? In the snippet, current_cart.has_print_orders? has to return true in order for the test to enter that conditional. So I took a look at the method:</pre><pre>class Cart &lt; ActiveRecord::Base</pre><pre>has_many :orders, proc { where(:removed =&gt; false) }</pre><pre>def print_orders<br>    @print_orders ||= orders.where(print: true).order(&#39;orders.created_at DESC&#39;).to_a<br>  end<br>end<br>In that method, I learned that carts have an association of has_many :orders, and this method was scoping those orders to print orders as opposed to non-print orders. We also know that with a print order, we can find its related event. In addition to learning about the code, you can also inspect the environment in a successful test run to see what <em>should</em> be happening. I put a binding.pry statement in that test and saw that the current_cart has several print_orders, each with a related_event.</pre><pre><strong>Making An Hypothesis: Indeterministic Ordering</strong></pre><pre>After gathering some clues, you can make some hypotheses. Did the related_event get deleted in another test? No, that shouldn&#39;t be possible because we are using transactional fixtures. This means that each test is wrapped in a transaction so that any changes performed in a test are rolled back. In the test we&#39;re looking at, there aren&#39;t any destroy calls. So even if another test deleted that event, it should be rolled back by the time this test started. Did an invalid print order get created and associated with the cart? Again, it shouldn&#39;t be possible for our test because of transactions. Is current_cart returning the right cart? Hm, that is an interesting idea. Let&#39;s take a closer look at the current_cart helper method.</pre><pre>def current_cart<br>  @current_cart ||= current_account.current_cart<br>end</pre><pre>It looks like it&#39;s grabbing the logged-in account and calling #current_cart on that account.</pre><pre>def current_cart<br>  carts.where(:complete =&gt; false).order(&quot;updated_at DESC&quot;).first<br>end</pre><pre>Aha! What if the current_account has multiple carts? The query that&#39;s generated above is SELECT * FROM &quot;carts&quot; WHERE (&quot;carts&quot;.account_id = &lt;id&gt;) AND (&quot;carts&quot;.&quot;complete&quot; = &#39;f&#39;) ORDER BY updated_at DESC LIMIT 1. Could it be returning the wrong cart? This reminded me of a recent issue that one of our engineers, Becca, observed. She saw that some records were missing and others were duplicated in a paginated API json response. Both these issues are similar and sounds like it could be an indeterministic ordering issue. But what is indeterministic ordering?</pre><pre>The fundamental reason for indeterministic ordering is because of how relational databases are implemented and how the SQL language is specified. The <a href="https://www.postgresql.org/docs/8.3/static/queries-order.html">Postgres documentation</a> says:</pre><pre>After a query has produced an output table (after the select list has been processed) it can optionally be sorted. If sorting is not chosen, the rows will be returned in an unspecified order. The actual order in that case will depend on the scan and join plan types and the order on disk, but it must not be relied on. A particular output ordering can only be guaranteed if the sort step is explicitly chosen.</pre><pre>Without an ORDER BY clause, the records can be returned in any way that&#39;s convenient to the database. In addition, if you specify a column for ORDER BY where several records have the same value, those records can be returned in any fashion.</pre><pre>This is a common issue and is an easy trap to fall into. Rails even changed their first and last <a href="https://github.com/rails/rails/pull/5153">ActiveRecord implementations</a> in Rails 4 to address this behavior. One solution is to use a unique column to order by. This <a href="https://thomascannon.me/posts/pagination-perils">article</a> goes into more detail about this issue and how to fix it.</pre><pre>Let&#39;s take a look at the carts in our test environment. Lo and behold, the fixtures file:</pre><pre>cart_1:<br>  account: account_1</pre><pre>invalid_cart:<br>  account: account_1<br>account_1 is the logged in user for our test and it has several carts. Since we didn&#39;t specify any timestamps for created_at or updated_at, they all have the same created_at and updated_at timestamps.</pre><pre>So, our theory is that the query in Account#current_cart is indeterministic and that any of these carts could be returned. We believe that carts(:invalid_cart) is being returned in some cases and it has a print order that does not have a related event. This explains the error and the stacktrace we were seeing. To fix this, we could update our query by adding an &quot;order by&quot; with a more specific clause such as order(&quot;updated_at DESC, id DESC&quot;). Or we could update the fixture file so that the carts have different timestamps.</pre><pre>So I decided to fix it with the latter approach.</pre><pre>cart_1:<br>  account: account_1<br>  updated_at: &lt;%= 5.minutes.from_now %&gt;</pre><pre>cart_1 should be selected from now on since it should have the a later updated_at timestamp. An interesting takeaway from this discovery is that we might have other queries with indeterministic ordering. To identify those queries, we could patch ActiveRecord such that it appended a ORDER BY random() to every query and then seeing if other tests fail. I did just that and the results were interesting, but I&#39;ll save that for another post.</pre><pre>I merged my changes believing that I have fixed the flake. But surprisingly, the flake is still happening! The same test and the same stacktrace were showing up in failed builds. Seems like my fix didn&#39;t address the issue so it&#39;s back to the drawing board.</pre><pre><strong>Put Logging Statements Everywhere</strong></pre><pre>This time, I wanted to learn more about the environment of the failing test. I used puts debugging to print out all possible state such as local variables and their associations if they were ActiveRecord models.</pre><pre>Is current_account returning the right account? Yes. Is current_cart returning the correct cart? No. Let&#39;s print out the account&#39;s carts at the beginning of the failing test and right before the exception.</pre><pre># At the start of the failing test<br>[<br> #&lt;Cart id: 1, created_at: &quot;2016-06-15 03:44:39&quot;, updated_at: &quot;2016-06-15 03:49:38&quot; .... &gt;, <br> #&lt;Cart id: 2, created_at: &quot;2016-06-15 03:44:39&quot;, updated_at: &quot;2016-06-15 03:44:39&quot; .... &gt;<br>]</pre><pre># Right before the exception<br>[<br> #&lt;Cart id: 2, created_at: &quot;2016-06-15 03:44:39&quot;, updated_at: &quot;2016-06-15 03:44:39&quot; .... &gt;, <br> #&lt;Cart id: 1, created_at: &quot;2016-06-15 03:44:39&quot;, updated_at: &quot;2016-06-15 03:40:23&quot; .... &gt;<br>]<br>At the start of the failing test, we can see the target cart (with id 1) and that it correctly contains an updated_at timestamp that is 5 minutes after the created_at timestamp. However, it looks like the updated_at timestamp of that cart changed somewhere in the failing test.</pre><pre><strong>Further Investigation (Spoiler Alert: Timecop)</strong></pre><h4>Jenkins/Host Problems</h4><pre>After I took a quick look at the controller code, I realized that we have some logic to set the default shipping option of an order if it doesn&#39;t already exist:</pre><pre>class CartsController &lt; ApplicationController<br>  def cart_modal<br>    ...<br>    current_cart.shippable_orders<br>      .select { |o| !o.valid_shipping_option? }<br>      .each(&amp;:set_default_shipping_option)<br>    ...<br>  end<br>end</pre><pre>This in turn touched the cart&#39;s timestamp because of the association:</pre><pre>class Order &lt; ActiveRecord::Base<br>  belongs_to :cart, touch: true<br>end</pre><pre>So that explains why the updated_at timestamp changed. But what&#39;s <strong>really interesting</strong> is that the timestamp used for updated_at is before the created_at timestamp. How did Time.now somehow end up going back in time?</pre><pre>I was extremely baffled from this behavior. My next hypothesis was that there is some weird time calculation going on in that Jenkins node. We run our tests on a single server so perhaps this is an OS level issue. I spun up a different Jenkins node to build our tests to see if flakes were only happening on that server.</pre><pre>Timecop</pre><pre>Nope. The flakes still showed up. Our staff operations engineer, Dan Diego, had an interesting insight and suggested that perhaps this flake is related to <a href="https://github.com/travisjeffery/timecop">Timecop</a>. Timecop is a library that allows you to travel in time by essentially mocking what Time.now would return. I added more debugging statements to see if Timecop was in play. Timecop mocks the Time.now method by aliasing the original Time.now to Time.now_without_mock_time and overriding Time.now with Time.now_with_mock_time. Here&#39;s the <a href="https://github.com/travisjeffery/timecop/blob/314882f24065190c446d8d1eb368f6985885dd28/lib/timecop/time_extensions.rb#L6-L17">implementation</a>. With that in mind, I wanted to see if time was mocked:</pre><pre>puts Time.now_without_mock_time.inspect</pre><pre>Hm, nothing interesting came out of that puts statement. Time wasn&#39;t being mocked when the flaky test is running. I then decided to record the time at the start of the test build in addition to the time when the flaky test is executed. Aha! The timestamps matched the weird updated_at timestamp. So actually, Time.now didn&#39;t end up going back in time. Instead, the created_at timestamps for the carts are in the future! Somehow, those fixtures were created with a future Time.now instance.</pre><pre>I again was baffled from this finding. Fixtures are created at the start of the test build (the <a href="https://github.com/rails/rails/blob/d0a5f878d32a4b95f5e866d3b5612acd4b7d16c7/activerecord/lib/active_record/fixtures.rb">entire fixtures implementation</a> is actually pretty succinct and readable). And the time at the beginning of the test suite is correct. I couldn&#39;t think of a reason for why fixtures would be created with an incorrect timestamp.</pre><pre>Transactional fixtures</pre><pre>After mulling this over for a while, I had another insight. We have some tests that turn off the transactional behavior of tests. This is because we needed to test functionality in after_commit callbacks. (This is <a href="https://github.com/rails/rails/pull/18458">fixed</a> in Rails 5, you can test those callbacks while still having the transactional fixture behavior). Would setting self.use_transactional_fixtures = false be forcing fixtures to be reloaded? Yes, in fact that&#39;s true! In the <a href="https://github.com/rails/rails/blob/d0a5f878d32a4b95f5e866d3b5612acd4b7d16c7/activerecord/lib/active_record/fixtures.rb#L984-L989">implementation</a>, Rails will remove existing records and re-insert them for each test case that have transactional fixtures off.</pre><pre>This is exciting because now we can explain why the cart would have a created_at timestamp in the future.Time.now must&#39;ve been mocked when those tests are running. Looking at the implementation of Timecop, if we traveled in time, Time.now will stay mocked until we execute Timecop.return to unmock Time.now. In our codebase, for the most part we were following best practice by calling Timecop.return whenever we traveled in time. But there were cases where we didn&#39;t do that.</pre><pre>So if a test traveled in time via Timecop.travel(5.minutes.from_now) and didn&#39;t call Timecop.return, then our test runner would have its time mocked and it would be in the &quot;future&quot;. Afterwards, if the test runner executes a test that calls Timecop.return, then time would be restored to the real time.</pre><pre>Wow. So our hypothesis is that first we need to run the test that puts the test runner in the future, then run a test that resets fixtures, then run a test that returns the runner to the correct time, and then finally, run the flaky cart test. I ran these exact tests locally and once they ran in the order I described above, I finally was able to reproduce the error. This validates our hypothesis!</pre><pre><strong>Conclusion And The Fix</strong></pre><pre>In the end, this flaky test issue boils down to misusing Timecop. We had a few lingering Timecop uses where we didn&#39;t unmock time at the end of the test. The fix was simple enough: make sure we return to the correct time at the end of each test. As an interesting side note, ironically, I was the developer who wrote those tests that traveled in time. I guess that&#39;s karma since I ended up spending time debugging and fixing these flakes.</pre><pre>The takeaway from this journey is to make sure you return time to its original time at the end of each test. In fact, I would recommend using Timecop.return as a global teardown block. Let&#39;s take a quick look at its implementation:</pre><pre># Reverts back to system&#39;s Time.now, Date.today and DateTime.now (if it exists) permamently when<br># no block argument is given, or temporarily reverts back to the system&#39;s time temporarily for<br># the given block.<br>def return(&amp;block)<br>  if block_given?<br>    instance.send(:return, &amp;block)<br>  else<br>    instance.send(:unmock!)<br>    nil<br>  end<br>end</pre><pre>...</pre><pre>def unmock!<br>  @baseline = nil<br>  @_stack = []<br>end<br>It looks like Timecop resets some internal values to make sure that time is no longer mocked. The implementation doesn&#39;t seem too costly with regards to performance and it seems that by doing it globally it would prevent future developers from making the same mistake that I did. And it makes sense too: after every test, you don&#39;t want time to be mocked so we can go ahead and unmock time.</pre><pre>In conclusion, tests are an important aspect of software development and we as developers should make sure the tests are not flaky. And if we see flaky tests, we should spend the appropriate time debugging and fixing the issue. In our case, we saw that Timecop was acting like a global state that’s shared across tests. We misused Timecop and its state leaked into other tests causing unexpected behavior. Make sure to reset global states between tests to avoid flaky tests.<br><em>Thanks to Brittany Wald, Jacy Clare, Mavreen Smiel, and David Cosgrove for reading and providing feedback to this blog post.</em></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc76e78c44a3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/how-i-tracked-down-a-flaky-test-fc76e78c44a3">How I tracked down a flaky test</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Homepage video]]></title>
            <link>https://medium.com/life-at-paperless/homepage-video-3ce1542556c9?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ce1542556c9</guid>
            <category><![CDATA[homepage]]></category>
            <category><![CDATA[brands]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Fri, 15 Jul 2016 15:49:18 GMT</pubDate>
            <atom:updated>2017-08-03T19:22:40.723Z</atom:updated>
            <content:encoded><![CDATA[<p>To celebrate our brand’s promise of connecting loved ones, we created a short film for our homepage that showcases a range of active events that all started with an invitation.</p><h4>The active event</h4><p>Every occasion is an emotional experience. Photographs can capture a moment, but engaging with an environment among the people you love is something that we set out to document through the moving image. Although there is nothing quite like attending an event in real time, there are key moments of interaction that we made a careful effort to concentrate on in each of these scenes.</p><p>[gallery size=”full” columns=”2&quot; link=”none” ids=”537,538&quot;]</p><p>[gallery columns=”2&quot; size=”full” ids=”540,541&quot;]</p><h4>It’s what we all have in common</h4><p>By approaching the film direction with one consistent vantage point and a common proportion for scale among people and party elements, we were able to focus on the common denominator that all hosts and their guests have in common: shared connection.</p><p>As an homage to this theme of connection, each of the scenes in the film begin and end with a body motion that is reciprocated by each preceding and following scene in the sequence. As the final scene reaches its end, the last gesture is repeated again in the first scene, creating a visual story that never concludes.</p><h4>take five</h4><p>Working on this project, our team learned a ton about what it takes to produce a short film. Even when an idea is simple, it still takes a team of people to come together, collaborating for a common goal. We also learned a great hand-modeling tip: between takes, always hold your hand upwards so that it looks as smooth and beautiful as can once the director is ready for the next take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ce1542556c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/homepage-video-3ce1542556c9">Homepage video</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The craft in our content]]></title>
            <link>https://medium.com/life-at-paperless/the-craft-in-our-content-a82787b1cf48?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a82787b1cf48</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[product]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Thu, 14 Jul 2016 21:24:14 GMT</pubDate>
            <atom:updated>2017-08-03T19:22:39.074Z</atom:updated>
            <content:encoded><![CDATA[<p>Our designs are made up of lots of different elements that come together seamlessly to form a final card design that act as the backdrop for our users to personalize with their unique messages and photographs. Before they go live on our site, they start as ideas for an occasion. From there the ideas travel through a journey which sees a variety of mediums and techniques being explored. The designs are revised and refined until they become cards that can be sent by our users.</p><p>[gallery columns=”2&quot; size=”full” ids=”491,492&quot;]</p><h4>DRAW, DRAW, REFINE, DRAW AGAIN</h4><p>No matter the occasion, every design process starts with lots and lots of sketching. Quick doodles to find interesting arrangements and then rounds of refinement until a composition is finalized to take to the next step in the journey.</p><p>[gallery columns=”2&quot; size=”full” link=”none” ids=”495,496&quot;][gallery link=”none” columns=”2&quot; size=”full” ids=”497,498&quot;]</p><p>With a finalized sketch, a medium is chosen, whether ink, watercolor, cut paper or in this instance, gouache, a steady hand follows along the sketch as a guide to bring the artwork closer to life.</p><h4>READY FOR SENDING</h4><p>The magical moment when all the pieces fall into place, creating a design that our users can make even more special when they add their personal touches.</p><h4>ONE IN THOUSANDS</h4><p>This is just one example of our approach in how we create our cards. With each card being a unique expression for a specific occasion, we try give each design it’s own creation journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a82787b1cf48" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/the-craft-in-our-content-a82787b1cf48">The craft in our content</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’re invited]]></title>
            <link>https://medium.com/life-at-paperless/youre-invited-4ff03e8e6ad7?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ff03e8e6ad7</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[culture]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Tue, 12 Apr 2016 21:10:52 GMT</pubDate>
            <atom:updated>2017-08-03T19:22:39.498Z</atom:updated>
            <content:encoded><![CDATA[<p>For six years, Paperless Post has focused on our hosts — the people seeking out the perfect invitations for their parties and paying us for virtual and physical paper. We concentrated our resources on designing thousands of unique cards for any occasion and building a sophisticated design platform and intuitive tools that make entertaining easier.</p><p>We’ve seen steady growth and success: a network of millions of people who use our product to connect with the people that matter to them in real life. This has given us the luxury of thinking more expansively about our audience and shift our focus to the silent majority of our users who are producing over 2 million card views every week: guests.</p><p>The guest of a Paperless Post event is an elusive figure. They might be unfamiliar with Paperless Post as an idea, and may even be completely unaware that they are using it. Yet they arrive on the site in droves, interacting with it in a meaningful way that affects their lives offline.</p><p>To understand this cohort of involuntary users and better serve them, it was time to examine the journey of guests — from receiving an invitation to RSVPing to attending the event — to uncover their unique pain points.</p><p>To understand this cohort of involuntary users and better serve them, it was time to examine the journey of guests — from receiving an invitation to RSVPing to attending the event — to uncover their unique pain points.</p><h4>So you’ve been invited to a party…</h4><p>To understand the needs of real-life party-goers, we needed to get into their heads — and their hearts. We held focus groups where we asked people about their experiences before and after parties: How did it feel to get the invitation? What affected whether they went or not? How did they get ready before the party? What was their mood afterward?</p><p>These conversations helped us map out what we called the “guest journey”: the behaviors and emotions that follow the catalyst of an invitation. It was important to note both the positive and negative experiences so we could amplify the good and alleviate the bad. It quickly became apparent that our biggest opportunities came at moments of mixed, and potentially frustrating, emotions: replying and attending.</p><h4>Yes, no, maybe:</h4><p>Deciding whether to go a party can be a tall order, with complicating factors like your relationship to the host, availability, feelings of obligation, connection with other guests, and expectations of the event itself. Easy access to the guest list and communication tools could facilitate a decision and response.</p><h4>Getting there:</h4><p>Once our hero has decided to attend the party, the next hurdle is getting from point A to point B. The easier it is for a guest to get to an event — whether they need directions, transportation details, or an Uber or to coordinate with other guests — the more likely they will actually arrive.</p><h4>Goodbye, antiquated animation.</h4><p>When an invitation arrives in your mailbox, whether it’s online or on paper, there’s a flicker of excitement: you’ve received something special. Right from the beginning (since our beta phase in 2008), we’ve sought to recreate the real-life experience of opening a physical envelope with an animated reveal. This animation became a staple of our product — to the point where people knew Paperless Post as the “one with the envelope that opens” — and, for many, a source of delight.</p><p>Others (looking at you, tech folks in our Twitter mentions), however, saw it as nothing but a time suck. Admittedly, it was slow. Very slow. Nine seconds slow — that’s seven seconds longer than 47% of web users expect a website to load in. Hardly the pace at which you eagerly open a bulky and beautifully calligraphed paper envelope.</p><p>In addition to its lag, the animation also hid the RSVP functionality and event page with additional details. To see one you had to navigate away from the other. Recipients were literally blocked from accessing all the information at once.</p><p>Finally, the animation wasn’t responsive across all platforms, leading to a big drop in engagement on mobile devices — where 55% of Paperless Post invitations are viewed. It was built with Adobe Flash, which had been the best option back in 2008 but had fallen quickly out of favor for web-friendliness since (as our trusty Twitter mentions were also quick to tell us).</p><p>It was plain to see that if we could remove the unnecessary time and distance within the card experience, maintaining the initial rush of receiving an invitation and giving recipients access to everything they need — we could significantly affect our reply rate.</p><h4>Prototype twice, build twice as fast.</h4><p>Once we identified our recipients’ three major blockers — a slow reveal, disjointed pages, and the inflexibility of Flash — “all we had to do” was figure out a solution.</p><p>We assembled a core team of two product designers, a front-end dev, and a product manager to scope, execute, and present prototypes for review by our Chief Product Officer and CTO every week. The group was deliberately kept small to encourage nimbleness and quick, informed decisions. Having a front-end developer dedicated to this project from the beginning was critical in allowing us to move back and forth between advanced Framer prototypes and HTML5/CSS3 implementations quickly to validate (or invalidate) our ideas.</p><p>The adage “measure twice, cut once” originated in the Medieval era but is no less true in the digital age. For three months, the core team toiled away on prototypes full-time before writing any production code. And it worked: after just ten months of work on what would typically have taken over a year, we had a quick, seamless, and — with the help of a new set of colors and typefaces from our Brand designers — sharp solution to our problems.</p><h4>Hello, new receiver experience.</h4><p>Our goal was to create a streamlined, Flash-less animation that’s integrated on a page with all the event details and is fast, functional, and exciting. With the majority of our recipients opening on mobile devices, we decided to tackle the mobile web experience first. Now, when you click to open an invitation, an envelope drops into the screen with the flap already open and quickly falls away while a full event page loads just below a virtual “ledge” where the card sits.</p><p>To give the card a more tactile “real-life” feel on a relatively tiny mobile screen, double-tap and pinch gestures allow you to zoom in on smaller design details that might otherwise be missed.</p><p>In lieu of our old reply card — a skeuomorph of the traditional paper version — the RSVP buttons are now an integrated part of the page and the most prominent UI elements below the card. We framed these buttons with key decision-making information, with the event name above and an “action grid” of event details below. Further down are less pressing features like links to gift registries and social components like a comment wall. As the guest scrolls down the page, the RSVP buttons stick to the top of the screen, giving them quick access to helpful information like date, time, location, host information, and attendee list without navigating away from the call to action.</p><p>In addition to the simple “yes” or “no” of your typical party RSVP, guests can be taken through a question flow submitted by the host about anything from +1s to meal selections to mailing addresses. To emphasize these actions as meaningful, we incorporated subtle animations throughout this flow.</p><p>Overhauling these guest-side pages also gave us an opportunity to apply a new visual voice to a complete product experience. The look that our Brand designers came up with is approachable and fresh, with large type set in a modular layout that quickly communicates key information. A neutral palette, supported by detail accents of our new colors Paloma (the orangey coral) and Gatbsy (the cerulean blue), allows the host’s invitation to stand out as the main focus.</p><p>Since we launched the new guest experience on mobile web this past October, we’ve seen definitive upward trends across all of our major metrics — RSVPs, engagement on guest tools, private messages, and comments — and a 30% decrease in page load time. Such a strong start is a testament to the time commitment we put in up front researching, prototyping, and testing, and we’re beyond thrilled with the results so far.</p><h4>The end (a.k.a. the beginning).</h4><p>As we were nearing the homestretch of our project, Facebook product design director Julie Zhou published an essay that really resonated with us. “Pretty much any time we design something new,” she begins, “we start at the middle.”</p><p>For years, we had considered hosts — the people seeking us out for their invitation needs — our singular target audience. They have a need and we’ve always helped them solve it to the best of our ability. And yet, we’ve since realized that sending out an invitation is, in actuality, the “middle.”</p><p>If, as Zhou writes, “the ‘beginning’ is how you introduce something new to a person, and. . . get them to understand its value such that they incorporate it into their lives,” then Paperless Post’s “beginning” is actually the recipient experience and the audience with the most potential is the guests. These are the people who might know nothing about our product yet are interacting with it in a way that’s meaningful in their lives offline. Whereas a repeat host will probably send their next invitation to the same (or a very similar) guest list, a guest that turns into a host likely has a social circle that only partially overlaps the host’s.</p><p>This is how delighting involuntary users — who aren’t paying us, who might not even know who we are — can have such an impact. When we provide guests with the best-possible first impression to our product, we create a path to the rest of our offering from discovery to education to value. What we once thought was the end of the host’s experience — the sending of the invitation and the real-life event that follows — is in fact the beginning of the journey for even more people.</p><p>Many thanks to the core team — <a href="https://twitter.com/_tarunc">Tarun Chakravorty</a>, <a href="https://twitter.com/joe_natalzia">Joe Natalzia</a>, <a href="https://twitter.com/kasparalexander">Kaspar Alexander</a>, <a href="https://twitter.com/wwwblainebot">Blaine Dangel</a>, and <a href="https://twitter.com/tinski">Tatum Lade</a> — and all the designers and technologists at Paperless Post that helped make this project a reality. Special thanks to <a href="https://twitter.com/trevorgrogers">Trevor Rogers</a> for the icon design, <a href="https://twitter.com/elishowalter">Eli Showalter</a> for gif troubleshooting, and <a href="https://twitter.com/stephaniehshih">Stephanie Shih</a> for help with this piece. “<a href="https://www.paperlesspost.com/cards/category/glitch?page=1&amp;version=online&amp;card=24464">Malibu Haze</a>,” the invitation featured in these images, was designed by <a href="https://twitter.com/robynical">Robyn Ng</a> for Paperless Post’s <a href="https://www.paperlesspost.com/cards/category/glitch?page=1&amp;version=online">Glitch</a> collection.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ff03e8e6ad7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/youre-invited-4ff03e8e6ad7">You’re invited</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest unit testing for React.js]]></title>
            <link>https://medium.com/life-at-paperless/jest-unit-testing-for-react-js-fc5133113d37?source=rss-912b2dfa3dc8------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc5133113d37</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[jestjs]]></category>
            <dc:creator><![CDATA[Paperless Post]]></dc:creator>
            <pubDate>Fri, 04 Mar 2016 15:00:59 GMT</pubDate>
            <atom:updated>2017-08-03T19:22:46.260Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s common knowledge at this point that unit tests have a variety of benefits. In this post I’ll be describing my trials and triumphs implementing Jest unit testing for React.js. Three aspects I grappled with while developing Jest-based testing were customizable defaults, manual mocking, and testing interaction with the document window.</p><h4>Customizable defaults</h4><p>Every React component has a set of props that are commonly passed down from parents to children. There are instances when your props may change later due to new data or data needed conditionally, so it’s advantageous that you can also declare new unknown props that may come later using the JSX spread operator. It’s reasonable to assume, when writing tests, that not only may you want to add props, but also change some of the defaults to assert a different outcome.</p><p>The question is, how can we provide default props to our component tests and also be able to supply differing prop values in a comprehensible way? Our example test will attempt to solve this by building a fresh component for each segment of the test using a factory pattern method and underscore defaults. The component will be given default props that can be overwritten at the time of object creation. The benefit of _.defaults is it will fill in undefined properties in the object as well as use the first value present in the following list of defaults objects. This means we can feed in different props to overwrite a property later to assert a different outcome, but otherwise the default props will be used.</p><p><em>The creation method:</em></p><pre>jest.dontMock(&#39;../component&#39;);</pre><pre>const MyComponent = require(&#39;../component&#39;);<br>window._ = require(&quot;underscore&quot;);</pre><pre>const createComponent = (props = {}) =&gt; {<br> const defaultProps = {<br>   onClick: jest.genMockFunction(),<br>   assets: 1<br> };</pre><pre>const ComponentProps = _.defaults(props, defaultProps);</pre><pre>return TestUtils.renderIntoDocument(&lt;MyComponent {...ComponentProps} /&gt;);<br>};</pre><pre>describe(&#39;Building the component with props&#39;, () =&gt; {<br> it(&#39;builds the component with one asset &#39;, () =&gt; {<br>   let component = createComponent();<br>   // We create our component with default props (assets: 1) so we&#39;ll expect one object<br>   expect(component.props.children.length).toBe(1);<br> });</pre><pre>it(&#39;builds the component with three asset &#39;, () =&gt; {<br>   let component = createComponent({assets: 3});<br>   // We create our component with new props (assets: 3) so we&#39;ll expect three objects<br>   expect(component.props.children.length).toBe(3);<br> });<br>});</pre><pre>Manual mocking</pre><pre>One of the core concepts of using Jest is mocking. Jest will automatically mock everything unless you explicitly tell it otherwise. As seen in the example above, in order to test using the real component, you&#39;ll need to tell Jest to not mock your component and then require it. Also take note that to use an external library like underscore we&#39;ll need to require it (in this procedure) and associate it with the _ character on the window.</pre><pre>This is all well and good, but what if you need more customizable mocking, say for an internal API? Our app uses a top-level configuration object that exposes the API of a related micro-service. This API returns information about the internal state of the micro-service, such as the mode your app is currently running in or some data formatted in an explicit way. Automatic mocking won&#39;t cut it here as our program is expecting nested objects that return a specific data format. The answer to this quandary is manual mocking. If you dig a bit in the documentation you&#39;ll find that just as Jest will automatically find your __tests__  directory, It&#39;ll do the very same with an appropriately located __mocks__  folder.</pre><pre><em>Top-level configuration mock object:</em></pre><pre>let Configuration = {<br> api: {<br>   exampleData: jest.genMockFunction().mockReturnValue([&#39;example 1&#39;, &#39;example 2&#39;])<br> },<br> whereAmI: &#39;Space&#39;<br>};</pre><pre>module.exports = Configuration;<br>Now we have a mocked version of our internal configuration API that when called upon within our component will return an expected response. But what if we need to augment this mocked file in our test to expect different outcomes like we did with our props? It wasn&#39;t immediately clear, but the solution here is to require the manually mocked version of the file in your test. From this point you can simply change the values of the object within the scope of your block at your own discretion.</pre><pre>// Require the mock file<br>const Configuration = require(&#39;../../lib/__mocks__/configuration&#39;);</pre><pre>describe(&#39;Tells the component where we are&#39;, () =&gt; {<br> let component = createComponent();<br> it(&#39;builds the component and tells the component where it is &#39;, () =&gt; {<br>   // overwrite the configuration value<br>   Configuration.whereAmI = &#39;Earth&#39;<br>   let renderedComponent = TestUtils.findRenderedDOMComponentWithClass(component, &#39;component--is-rendered&#39;);<br>   expect(renderedComponent.getDOMNode().textContent).toBe(&#39;We are on Earth&#39;);<br> });<br>});</pre><pre>Interaction with the document window</pre><pre>The goal in React is to write &#39;pure components&#39;, but sometimes in practice your code can&#39;t be so tidy. In one area of our code a component has to listen for a click on the document window. Jest doesn&#39;t really care about what&#39;s happening outside of React, providing a way to simulate a click event on a component, but not for the document window. Inserting the document as a parameter for ReactTestUtils would have been a nice addition for this common interaction, but this is unavailable. Nevertheless, there is a work-around for this situation. We can manually create an event and listen for it before making an assertion about the change in component state.</pre><pre><em>Manual creation of a document click event:</em></pre><pre>expect(component.state.documentWasClicked).toBe(false);<br>var evt = new Event(&quot;click&quot;, {&quot;bubbles&quot;: false, &quot;cancelable&quot;: true});<br>document.addEventListener(&#39;click&#39;, component.onDocumentClick);<br>document.dispatchEvent(evt);<br>// Our component state has responded to our manually created click event<br>expect(component.state.documentWasClicked).toBe(true);</pre><h4>Conclusion</h4><pre>I found Jest provided a very helpful way to test React components, with the ability to easily use your actual components and render them into a mocked DOM. That being said, the gritty reality of a code base can present unique challenges that Jest is not well-equipped to handle. Shifting parameters that change output, mocked objects for tests that depend upon specific data structures, and code that interacts with the document window all add complexity to Jest unit tests. Hurdles aside, with some effort you can customize, mock, and simulate almost anything you need. This technology gives a feasible and friendly route to test the front-end of your React application.</pre><pre>Special thanks to Becca Liss and Joe Natalzia for helping me at various stages.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc5133113d37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-at-paperless/jest-unit-testing-for-react-js-fc5133113d37">Jest unit testing for React.js</a> was originally published in <a href="https://medium.com/life-at-paperless">Life at Paperless Post</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>