<?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 Jordan Jasuta Fischer on Medium]]></title>
        <description><![CDATA[Stories by Jordan Jasuta Fischer on Medium]]></description>
        <link>https://medium.com/@jordanjasuta?source=rss-c775e0fa3d6f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fS__-PjgOA_HgT-K</url>
            <title>Stories by Jordan Jasuta Fischer on Medium</title>
            <link>https://medium.com/@jordanjasuta?source=rss-c775e0fa3d6f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:19:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jordanjasuta/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[Fatal mistakes to avoid when designing an AI system]]></title>
            <link>https://jordanjasuta.medium.com/fatal-mistakes-to-avoid-when-designing-an-ai-system-952a4a1fb6de?source=rss-c775e0fa3d6f------2</link>
            <guid isPermaLink="false">https://medium.com/p/952a4a1fb6de</guid>
            <category><![CDATA[ml-so-good]]></category>
            <category><![CDATA[listicles]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Jordan Jasuta Fischer]]></dc:creator>
            <pubDate>Tue, 18 Jan 2022 13:44:55 GMT</pubDate>
            <atom:updated>2022-01-20T17:07:25.929Z</atom:updated>
            <content:encoded><![CDATA[<h3>8 Fatal mistakes to avoid when ordering an AI system</h3><h4>A guide for non-technical clients and managers ordering an AI project, from someone who has been both a technical developer and a manager, with love.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1pNVfhw93s-L1Cs84sRrQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sammiechaffin?utm_source=medium&amp;utm_medium=referral">Sammie Chaffin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Artificial Intelligence (AI) is a relatively new and rapidly changing industry. It is widely understood that AI has the potential to transform how we live and work, but the details of how it might do this are much more elusive. The widespread hype around AI and machine learning (ML) increases both interest in and confusion about AI projects<a href="#_ftn1">[1]</a>. It doesn’t help that most managers feel pressure to know about advanced technology without asking questions.</p><p>The combination of high expectations and poor understanding provides perverse incentives in AI projects to prioritize quickly building models with flashy results, and allocate minimal resources to the dull but critical work of making sure a system will continue to perform well after an initial contract has ended. As a result, developers (devs) can face pressure to undercut their own systems if it is faster or more convenient at the outset. Shortcuts like using bad training data can lead to poor model performance– something that neither devs nor their managers nor their clients want. Such outcomes can be hard to avoid, however, in cases where the people ordering the system don’t understand the implications of what they’re asking for.</p><p>Good news: the person ordering an AI system (whether internal manager or external client) doesn’t need to be an expert in machine learning in order to design and implement a great AI project. After all, it’s not their job to understand AI/ML any more than it is their job to understand the practical details of an appendectomy surgery — different professionals specialize in different areas, and this specialization allows each of us to deepen our knowledge in a particular field. Instead, to design and manage a great AI project, a manager needs to understand the basic inputs that AI needs to function, and what outputs they can realistically expect given those inputs.</p><p>Unfortunately, given the relatively <a href="https://www.softwaretestingnews.co.uk/firms-lack-the-knowledge-to-deal-with-ai-reveals-survey/">early stages</a> of AI adoption in most industries, and the <a href="https://www.forbes.com/sites/steveandriole/2017/05/15/the-lack-of-intelligence-about-artificial-intelligence/?sh=27e85a6e5ebd">poor understanding</a> of AI among the general public, managers are still vulnerable to a number of mistakes in the design and execution of AI and ML projects. The following mistakes can be absolutely fatal to the success of a project, but can easily be avoided by just being mindful of them — no machine learning classes required.</p><ol><li><strong>Failing to define the problem clearly </strong><br>What do you want to achieve with AI? Too often, I have seen managers focus on the <em>idea</em> of using AI, without thinking through how the outcomes will be used in practice. Define the problem clearly before you try to solve it — and remember, flashier solutions aren’t always the best ones! Instead of saying, ‘I heard about this cool technique, what can it do for me?’ a lot more can be achieved by identifying an existing problem and asking, ‘what techniques might help me with this?’ You don’t need to identify exactly <em>how </em>the problem should get solved, but you do need to be able to articulate what the problem is. A good AI architect or developer should be able to walk you through how potential AI solutions will address your problem and help you select the most appropriate one.</li><li><strong>Focusing on tasks instead of outcomes</strong> <br>As a manager or client, focusing on specific tasks can drag down system functionality, cause confusion among developers, and delay successful development. Tasks are interchangeable and only really need to be understood by the devs who will execute them; outcomes are much more concrete over the life of the project, and should be agreed upon by all relevant stakeholders. A manager who measures progress by the accomplishment of specific tasks will have a hard time adapting when a better way to achieve the same outcome is identified. A manager who measures progress by the attainment of outcomes needs only confirmation that the outcome has been achieved, leaving devs free to optimize the details of their work as they see fit.</li><li><strong>Not asking questions because you don’t want to look stupid</strong><br>This is a normal but hugely counterproductive human instinct, especially in some industries where prestige is the primary currency. If you are worried about sounding foolish, you can try googling a question before asking it, but please do not hesitate to ask your developers and architects about technical things that you are not familiar with. Part of their job is to make sure you understand what they are selling you, but they won’t be able to do this if you feign knowledge to save face. If you do not understand what you are agreeing to, all kinds of nasty problems can arise down the line. There is no shame in not understanding something technical — help your developers help you to make the right decisions!</li><li><strong>Failing to prioritize training data </strong><br>You have probably heard that training data can be used to train machine learning models. But you might not be aware that without training data it is literally impossible to produce a ML model. The <a href="https://mitsloan.mit.edu/ideas-made-to-matter/machine-learning-explained">defining factor</a> of machine <em>learning</em> is that the model needs to ‘study’ data to ‘learn’ to do its task. Furthermore, bad training data means the model will learn the wrong things and produce the wrong results. This means that not only do you need training data, but also that the training dataset needs to be robust, accurate, and consistent. Training data should contain many records of your problem being solved the way you want it to be solved — if you are trying to automate a task, this would be examples of the task being done correctly, or if you are trying to identify specific conditions, examples of those conditions that have already been identified.<a href="#_ftn2">[2]</a> <br>Because adequate training data is such an important requirement for ML models — but often hard to come by — shortcuts such as <a href="https://www.analyticsvidhya.com/blog/2021/10/understanding-transfer-learning-for-deep-learning/">transfer learning</a> have been developed to lighten the burden of securing training data. These <em>lighten</em> the burden, but do not eliminate it. No machine learning model is truly free of the need for training data. <br>(In AI there is an exception to this rule: rules-based models, which are not ML but are still a type of AI, do not require training data. For rules-based models, you’re not completely off the hook — the development of these models will still require clear discussion(s) with subject matter experts to define the rules the model will use, but this can be a useful technique if training data is impossible to come by. Not all problems can be addressed with rules-based models, so this isn’t a panacea for lack of training data. For more info on rules-based versus ML classification models, see <a href="https://bdtechtalks.com/2020/06/05/rule-based-ai-vs-machine-learning/">this article</a>, or for info on hybrid models, see <a href="https://www.youtube.com/watch?v=YHAeGBM9z3I&amp;feature=youtu.be">this talk</a>)</li><li><strong>Employing corrupt or misleading data to get enough training data</strong><br>Sadly, the number of observations alone is not enough to ensure a good training set. Sometimes training data can be gathered quickly by harvesting many easily available records that ‘occur in nature’, i.e. are already available in a system, without thorough review. This kind of dataset — even if it includes millions of rows — can lead to a lot of problems. You might have heard about AI discriminating to favor men in <a href="https://www.reuters.com/article/us-amazon-com-jobs-automation-insight/amazon-scraps-secret-ai-recruiting-tool-that-showed-bias-against-women-idUSKCN1MK08G">hiring algorithms</a>, or to facial recognition technology <a href="https://www.nytimes.com/2018/02/09/technology/facial-recognition-race-artificial-intelligence.html">recognizing light-skinned faces</a> best. The most readily available observations might not be the best to train your model on, and can include existing societal biases that you (hopefully) don’t want to perpetuate. The relative prevalence of a type of observation in a training set has a big influence on the weights the model will assign to different features. This can have both ethical and business implications for your AI system. To begin exploring the tip of the iceberg that is the complex problem of statistical bias in AI, check out <a href="https://towardsdatascience.com/what-is-statistical-bias-and-why-is-it-so-important-in-data-science-80e02bf7a88d">this article</a>.</li><li><strong>Making dead models for living systems</strong> <br>Imagine you’re training a shopping recommendation algorithm on users’ preferences gathered over a period of 6 months. But the algorithm is supposed to be in use for years. Trends change, users mature, and soon a young professional is being recommended out-of-style kid’s clothes instead of the sleek office wear that would be appropriate to his current lifestyle. This algorithm would obviously never survive in the real world of fast fashion — real advertisement algorithms are <a href="https://www.wired.co.uk/article/ai-personalised-shopping">constantly adapting</a> to users’ updated preferences by continually ingesting new data. <a href="https://www.oreilly.com/library/view/building-machine-learning/9781492053187/ch13.html">Feedback loops</a> keep models relevant even as the users and conditions around it change.<a href="#_ftn3">[3]</a> For more information on responsive and adaptive AI systems, check out <a href="https://www.clarifai.com/blog/closing-the-loop-how-feedback-loops-help-to-maintain-quality-long-term-ai-results">these</a> <a href="https://databistro.tech/moving-towards-scalable-responsive-and-sustainable-machine-learning/">blogs</a> or <a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">this paper</a>.</li><li><strong>Making dependent models</strong> <br>Nothing is permanent. That includes your employees, supply contracts, and hard drives. Models that rely on people or systems that will eventually go away are models that will become unusable, and it’s a good idea to design your AI systems with this in mind. The importance of <a href="https://www.software.ac.uk/blog/2016-10-03-why-reproducibility-important">reproducible code</a> <a href="https://levelup.gitconnected.com/why-documentation-is-more-important-than-your-code-f5607639a8fe">and</a> <a href="https://filtered.com/blog/post/project-management/the-importance-of-documentation-in-software-development#:~:text=For%20a%20programmer%20reliable%20documentation%20is%20always%20a%20must.&amp;text=Successful%20documentation%20will%20make%20information,and%20help%20cut%20support%20costs.">documentation</a> are well-understood in coding communities, but they can be time consuming, and many clients have no interest in paying for the extra effort up front to ensure that code can be effectively run years later. Resist this short-sighted instinct! Even your code base itself can disappear if it is stored in an unsustainable location (i.e. a single developer’s computer). Your technical developers should be very familiar with tools like <a href="https://github.com/">GitHub</a> and <a href="https://bitbucket.org/product">BitBucket</a>, that enable them to track changes as they work, collaborate with teammates, manage deployments, and preserve and update documentation. Extra time and effort spent on making a system sustainable now will be well worth it to ensure the longevity of the project.</li><li><strong>Forgetting about user experience </strong><br>If a system is hard or confusing to use, if access is too difficult, it will never be widely adopted by users. In addition to a clear and instinctive interface, you should also make sure that the system you are designing is comfortable to access, and easy to get results from. This should not be an afterthought. It takes time, planning and resources to embed a model or AI system in an organization’s overall operations. There is an entire profession dedicated to UX/UI (<a href="https://www.springboard.com/library/ui-ux-design/job-description/">user experience and user interface</a>) in which your AI and ML developers may or may not have a secondary specialization. It’s worth investing in user experience — and understanding that it is an overlapping but separate career from AI development — to ensure that your AI system can bring its promised benefits to your organization.</li></ol><p>AI and ML have taken many industries by storm, and as with any other technology, they can be beneficial, a waste of resources, or harmful, depending on how they are used. When ordering an AI system (either from your own employees or a contractor) you genuinely don’t need to know the gritty details of how AI works, but you do need to understand some overarching concepts and hazards around AI. The key to unlocking AI’s benefits for your organization lies in using it well — and avoiding these fatal mistakes.</p><p><a href="#_ftnref1">[1]</a> First, a clarification: machine learning is a type of artificial intelligence. So all ML is AI, but not all AI is ML. See helpful blogposts <a href="https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/">here</a> and <a href="https://towardsdatascience.com/ai-machine-learning-deep-learning-explained-simply-7b553da5b960">here</a>.</p><p><a href="#_ftnref2">[2]</a> The fact that this paragraph is probably coming as a surprise to many readers is a source of confusion and frustration in many AI and ML projects, and has often driven me to contemplate writing a blog or article titled “Machine Learning is not Magic”. Sadly, no, machine learning cannot conjure results out of nothing.</p><p><a href="#_ftnref3">[3]</a> Note that unsupervised feedback loops can end up blindly ingesting problematic data (see Fatal Mistake #5). For more details, see <a href="https://medium.com/unpackai/feedback-loops-friend-or-foe-81a552203228">this post</a> or this famous <a href="https://theconversation.com/feedback-loops-and-echo-chambers-how-algorithms-amplify-viewpoints-107935">use case</a> about social media.</p><p><a href="https://medium.com/mlearning-ai/mlearning-ai-submission-suggestions-b51e2b130bfb">Mlearning.ai Submission Suggestions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=952a4a1fb6de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Source Social Listening]]></title>
            <link>https://jordanjasuta.medium.com/open-source-social-listening-278bd5e84011?source=rss-c775e0fa3d6f------2</link>
            <guid isPermaLink="false">https://medium.com/p/278bd5e84011</guid>
            <category><![CDATA[social-listening]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[social-media]]></category>
            <dc:creator><![CDATA[Jordan Jasuta Fischer]]></dc:creator>
            <pubDate>Thu, 11 Feb 2021 22:15:26 GMT</pubDate>
            <atom:updated>2021-02-23T14:51:44.487Z</atom:updated>
            <content:encoded><![CDATA[<h4>Applications for the public sector</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OMqypKYiD29Vqt7V" /><figcaption>Photo by <a href="https://unsplash.com/@gawlowski?utm_source=medium&amp;utm_medium=referral">Tomasz Gawłowski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Social listening is used to keep a finger on the pulse of public opinion. Traditionally, social listening has been used to assess consumers’ opinions in the private sector, but it can be adapted to public and government uses to great effect. Social listening <a href="https://marketingland.com/social-listening-267175">can be used to</a>:</p><p>• Get feedback on a product or policy</p><p>• Monitor industry context</p><p>• Analyze competition</p><p>• Manage public relations and reputation</p><p>• Generate leads or targets in campaigns</p><p>• And more</p><p>This information is valuable to governments and government agencies, especially in representative democracy, where constituents’ reactions to policy are crucial decision-making input. Government bodies and actors need to manage their reputations, and even assess rivals.</p><p>There are a number of platforms that have been built to provide social listening services, but they are often expensive, and the cheaper options are not always very customizable. In a private sector budget, there is usually room for pricey software, but in the public sector this is less often the case. Luckily, open coding languages like Python and R offer the tools to build a free, open source, completely customizable analysis workflow that you can pick apart and change as you see fit.</p><p>Let’s work with a simple example: a municipality wants to understand how its residents feel about a proposal to expand bike lanes downtown.</p><h3>Data Source(s)</h3><p>The first thing we (the municipality) need to do, is consider our data source. Social media platforms are location- and demographic-specific. For example, if we want to study what senior citizens think, TikTok is probably not our best option. The data source(s) should match the target of our social listening.</p><p>Pew research has put out some interesting <a href="https://www.pewresearch.org/internet/fact-sheet/social-media/">data on the demographics</a> of the users of different platforms in the US.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*bt1xKP6t2ub2WeMHxYQomQ.png" /><figcaption>Graph created in R using Pew Research&#39;s data</figcaption></figure><p>So, when we think of bike lanes, whose opinions are we worried about?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*UY0-YI_75cZbtawAdfzrxQ.png" /><figcaption>Graphs made in R using Pew Research&#39;s data</figcaption></figure><p>Downtown residents are young, urban and educated. They are often politically active. Twitter will be a good place for us to start.</p><h3>Representativity</h3><p>When working with social media data, the question of representativity often comes up. No, of course social media data is not representative of the population at large, but we neither expect nor need it to be.</p><p>In social listening, the members of society that are most vocal — who are also the most likely to publish about issues online — are the voices that we’re most interested in. In contrast to traditional statistics, social media’s tendency to capture a population’s most extreme voices can actually be an asset in social listening.</p><h3>Pulling the data</h3><h4>APIs</h4><p>There are, as they say, many ways to skin the cat. Some social media sites, such as <a href="https://developer.twitter.com/en/docs/twitter-api">Twitter</a>, have an official API, or application programming interface (<a href="https://developers.facebook.com/docs/graph-api/">Facebook</a> and <a href="https://rapidapi.com/collection/instagram-apis">Instagram</a> can be accessed through a variety of official and unofficial APIs). <a href="https://en.wikipedia.org/wiki/API">APIs</a> require that a user register to receive an access token, which they can use to pull data within a script using a personal key. Note that not all APIs are compatible with all coding languages — the <a href="https://www.linkedin.com/developers/">LinkedIn API</a> is compatible with only Bash, NodeJS and Java.</p><p>One problem with APIs is that they are wont to block more ‘enthusiastic’ users. When blocked, users can try to jump servers or otherwise disguise themselves, but often it is a dead end. In these cases, good old fashioned web scraping is another way to get data.</p><h4>General scraping tools</h4><p>Social media platforms are just websites, and as such can be scraped using ordinary web scraping tools like <a href="https://blog.rstudio.com/2014/11/24/rvest-easy-web-scraping-with-r/">Rvest</a>, <a href="https://pypi.org/project/beautifulsoup4/">Beautiful Soup</a>, or <a href="https://pypi.org/project/selenium/">Selenium</a>. However, the structure of each site can be specific, repetitive, and tedious to navigate, meaning that the ever-innovating open code community has yielded a number of handy platform-specific tools to pull social media data to your machine.</p><h4>Social-media specific packages</h4><p>In R, <a href="https://www.rdocumentation.org/packages/twitteR/versions/1.1.9">twitteR</a> is a tidy way to pull data from Twitter, and <a href="https://github.com/JonasSchroeder/InstaCrawlR">instaCrawlR</a> and <a href="https://github.com/royfrancis/iscrape">iscrape</a> do the same from Instagram. Python has tools that do the same thing, from <a href="https://github.com/drawrowfly/tiktok-scraper">TikTok</a> to <a href="https://pypi.org/project/linkedin-scraper/">Linkedin</a>, in relatively few steps. An especially user-friendly tool for scraping Twitter is <a href="https://github.com/twintproject/twint">twint</a>, which, after installation, can be run from the command line or <a href="https://medium.com/@erika.dauria/scraping-tweets-off-twitter-with-twint-a7e9d78415bf">within Python</a> using very few lines of code.</p><p>Because of the ever-changing nature of social media sites, the creators of these packages must constantly <a href="https://medium.com/@jonas.schroeder1991/update-instacrawlr-still-crawling-6500cd376ea3">monitor and update them</a> to <a href="https://github.com/twintproject/twint/issues/1023">keep up with sites’ changes</a> and some may eventually fall into disrepair. A quick search will usually tell you if your tool of choice needs updates.</p><h3>Raw data, check. Now what?</h3><p>Once we have our data, we start with the same <a href="https://towardsdatascience.com/nlp-text-preprocessing-a-practical-guide-and-template-d80874676e79">basic pre-processing</a> as any other <a href="https://en.wikipedia.org/wiki/Natural_language_processing">NLP</a> project. We strip punctuation — considering carefully how characters like ‘#’ and ‘@’ will affect the analysis — and drop <a href="https://en.wikipedia.org/wiki/Stop_word">stop words</a>. Particularly in social media text, emojis are common and can have important meaning. While sometimes they are dropped from the text, a more <a href="https://studymachinelearning.com/text-preprocessing-handle-emoji-emoticon/">meaningful management</a> is to <a href="https://towardsdatascience.com/text-preprocessing-for-data-scientist-3d2419c8199d">convert them to words</a>. We can also use more advanced techniques like running text through a spellcheck (since social media is rife with misspellings, which can affect algorithms that consider each new misspelling a fresh word) using tools like R’s <a href="https://github.com/ropensci/spelling">spelling</a> package, or custom-built <a href="https://en.wikipedia.org/wiki/Approximate_string_matching">fuzzy matching</a> tools. Note that these tools are checking input text against a dictionary of accepted words, to identify cases where input words are very similar to accepted words, overwriting them with the accepted words. Depending on the specific vocabulary of your subject matter, it might be important to revise or adjust the base dictionary.</p><p><a href="https://medium.com/swlh/introduction-to-stemming-vs-lemmatization-nlp-8c69eb43ecfe">Lemmatization</a> is another important technique that can go a long way towards the impact of text data. Along with stemming, lemmatization is used to collapse all conjugations of a word to either the infinitive or the root: instead of counting ‘am’, ‘are’, and ‘is’ as three functionally distinct words, all these words would register as the single verb ‘be’. The occurrence of this infinitive or root will be the sum of its conjugations, and therefore have more impact than each conjugation separately. This can be done with <a href="https://stackabuse.com/python-for-nlp-tokenization-stemming-and-lemmatization-with-spacy-library/">SpaCy</a> in Python or <a href="https://www.rdocumentation.org/packages/textstem/versions/0.1.4">textstem</a> in R. Some tools like R’s <a href="https://cran.r-project.org/web/packages/hunspell/vignettes/intro.html">hunspell</a> will stem, tokenize and spell check words all in one package.</p><p>Lemmatization may be increasingly important — and pre-built packages/dictionaries increasingly scarce — in languages besides English. Romance languages, for example, conjugate verbs in each tense, instead of just some tenses like English. A recent release of <a href="https://github.com/pablodms/spacy-spanish-lemmatizer">Spanish language lemmatization</a> that takes into account part of speech has greatly improved on previously existing versions.</p><p>Returning to our example of bike lanes, what kinds of things do we want to know about the policy reception?</p><p>• How people feel about bike lane expansion</p><p>• What parts of the policy have them concerned</p><p>• What kind of people feel strongly enough about the policy to tweet about it</p><p>And what will this information allow us to do from a policy perspective?</p><h3>Unsupervised learning to understand context</h3><p>Since we don’t want to lead the analysis, we can start with some simple exploratory techniques. Out of the box sentiment analyses like Python’s <a href="https://stackabuse.com/sentiment-analysis-in-python-with-textblob/">textblob</a> or R’s <a href="https://www.rdocumentation.org/packages/tidytext/versions/0.2.6/topics/get_sentiments">dplyr/get_sentiments()</a> allow us to get a basic feel for the public’s reception.</p><p>For the proposed bike lanes, we can use the preset lexicon ‘afinn’ to get a polar sentiment analysis of relevant Tweets to see that the reception has been mostly positive in the days since the proposal was announced, spiking on the day that a press release was held to address the issue:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*52oxZT7lCp4puGa6-zEQjA.png" /><figcaption>Graph made in R using afinn package sentiment analysis</figcaption></figure><p>While the package includes more specific sentiment lexicons — i.e. differentiating between sad and angry instead of just ‘negative’ — this can be highly sensitive to context. The preset lexicon ‘nrc’ associates the word ‘police’ with safety, which, in light of much of the social media content posted in the past year, is ironic at best.</p><p>After this first pass at the data, we can get more detailed and more specific using topic modelling techniques. R’s <a href="https://www.rtextminer.com/">textmineR</a> and <a href="https://www.rdocumentation.org/packages/tidytext/versions/0.2.6">tidytext</a> packages and Python’s <a href="https://medium.com/mlreview/topic-modeling-with-scikit-learn-e80d33668730">scikitlearn</a>, <a href="https://towardsdatascience.com/topic-modelling-in-python-with-nltk-and-gensim-4ef03213cd21">gensim, and nltk</a> packages provide the tools for custom topic modeling using two techniques in particular:</p><p>• Tf-idf (<a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf">term frequency-inverse document frequency</a>)</p><p>• LDA (<a href="https://en.wikipedia.org/wiki/Latent_Dirichlet_allocation">Latent Derichlet allocation</a>)</p><p>Tf-idf uses two sets of statistics (unsurprisingly, term frequency and inverse document frequency), which is a very basic way to ‘vectorize’ words in order to determine the importance of a word within the context of the document. Latent Dirichlet allocation is a generative probabilistic model which is a bit like the lovechild of bag-of-words vectorization and clustering, used to sort documents into topics. These two techniques help us extract features like keywords, and understand what topics are most ‘talked about’.</p><p>In some cases, like with our bike lanes example, the LDA model might produce an optimized number of topics that is too high to be practical for our analysis. In this case we can generate a dendrogram to manually cluster the topics further. This one was <a href="https://towardsdatascience.com/beginners-guide-to-lda-topic-modelling-with-r-e57a5a8e7a25">generated in R</a> using the <a href="https://www.rdocumentation.org/packages/textmineR/versions/3.0.4/topics/CalcHellingerDist">CalcHellingerDist()</a> and <a href="https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/hclust">hclust()</a> functions on the results of an existing LDA model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*HTZqywPIPrSCJnh0GqZXEQ.png" /><figcaption>Dendrogram generated in R using CalcHellingerDist() and hclust() to group topics</figcaption></figure><p>We can thus narrow down the most common topics of conversation to those regarding safety, traffic and the environment.</p><p>This unsupervised/exploratory analysis sets the stage and helps us understand how people feel generally about the policy, and what parts of it are most interesting to them.</p><h3>Supervised learning to prescribe action</h3><p>Once we understand the general context of the issue, we need to decide how to act. There are two families of supervised techniques we can use to prescribe action.</p><h4>Classification</h4><p>Classification can be used to sort twitter users into profiles according to their opinion type or priorities, and thus to determine what action the government should take to address such citizens’ concerns. Popular NLP classification techniques include <a href="https://medium.com/analytics-vidhya/tf-idf-term-frequency-technique-easiest-explanation-for-text-classification-in-nlp-with-code-8ca3912e58c3">tf-idf</a> (the feature extractor we discussed in the previous section can be combined with a simple NN classifier to create an NLP classification model) and bag-of-words techniques like <a href="https://towardsdatascience.com/introduction-to-word-embedding-and-word2vec-652d0c2060fa">word2vec</a> and <a href="https://towardsdatascience.com/implementing-multi-class-text-classification-with-doc2vec-df7c3812824d">doc2vec</a>.</p><p>The slightly more complex RNN model offers the benefit of analyzing documents word-by-word which allows for more flexibility. Recently <a href="https://arxiv.org/abs/1611.06639">bi-directional RNN models like LSTM</a> and <a href="https://allennlp.org/elmo">ELMo</a> (a technique which famously fuels Google’s <a href="https://github.com/google-research/bert">BERT</a> model) have become the state of the art.</p><p>These diverse techniques all do the same thing — they sort documents (here ‘document’ means any standalone chunk of text) into categories when trained on relevant labeled text data. For our bike lane example, we can use classification to sort tweets into categories for further review. Note that for the most part, classification only yields one result per model — that is, it sorts each document into a single category, even if the document might theoretically belong to multiple categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*oN-MY2svYoGjsixDHyI0wA.png" /><figcaption>Example of classification to a single category</figcaption></figure><h4>Annotation</h4><p>In cases where one result per model will limit the accuracy of the analysis, annotation can provide a better solution. From named entity recognition (NER) to complex pattern matching, annotation searches document text for specific strings or patterns, and tags the documents with any and all results found. Some packages like R’s <a href="https://github.com/trinker/entity">trinker/entity</a> identify pre-set entities like dates, people, and monetary amounts, and can be employed effectively for specific purposes. For complex/custom patterns, Python’s SpaCy (or the R equivalent spacyr) provide highly customizable packages for NER, pattern matching, parts of speech tagging, and <a href="https://realpython.com/natural-language-processing-spacy-python/">more</a>. For those with programming knowledge beyond the common data analytics languages of R and Python, there are powerful tools, such as <a href="https://nlp.stanford.edu/software/CRF-NER.html">Stanford’s CRF-NER</a> powered by languages like Java.</p><p>The tweet below touches on multiple subjects — safety, traffic, and children — as well as the subject of bike lines itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*1Dng5XVP_kCfmjgtJvpcXA.png" /><figcaption>Example text encompassing multiple categories</figcaption></figure><p>While most classifiers would be forced to select a single category, annotation can tag multiple issues of concern in each tweet, as seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*Q_pFYiKSnIgfraqjTnrhcA.png" /><figcaption>Example text after annotation shows multiple categories tagged based on tokens found</figcaption></figure><h3>Application in the public sector</h3><p>The modeling techniques discussed above can be applied to a wide range of public sector social listening functions. We have already considered at length their usefulness in obtaining feedback on a proposed policy. Sentiment analysis and topic modeling can also be used to monitor industry context and predict receptiveness to new policies even before they are proposed.</p><p>These unsupervised techniques, as well as annotation if the context is well known, can also be used to analyze competing governments, to understand what topics are associated with one government versus the other, and to manage public relations and reputation. Similarly, classification can be used to sort people into groups based on their attitudes towards an entity or policy.</p><p>We typically think of lead generation as businesses targeting clients, but it can also be important for targeting specific constituents or sectors of the public. Going back to the bike lane example, if we find that some people are misinformed about the policy, we might want to run an information campaign, and classification will allow us to better identify which people should be targeted by this campaign.</p><p>These NLP and machine learning tools can be applied creatively to answer many social listening questions using 100% open-source programming tools, such as R, Python, Unix shell, and Java. While purpose-specific software might require less work at the outset, open-source tools provide unrivaled flexibility, customization, replicability and transparency (a feature often important in public work), for the unbeatable cost of $0.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=278bd5e84011" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>