<?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[b.telligent Data Science &amp; AI - Medium]]></title>
        <description><![CDATA[The methods of data science and artificial intelligence serve to identify useful patterns and structures in data and, ideally, translate them at once into automated actions. - Medium]]></description>
        <link>https://medium.com/b-telligent-data-science-ai?source=rss----bc8ff6d8f70a---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>b.telligent Data Science &amp;amp; AI - Medium</title>
            <link>https://medium.com/b-telligent-data-science-ai?source=rss----bc8ff6d8f70a---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:30:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/b-telligent-data-science-ai" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to install Ray under Windows]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/how-to-install-ray-under-windows-db14681180f7?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/db14681180f7</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Allgöwer]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 12:03:31 GMT</pubDate>
            <atom:updated>2021-12-22T12:03:31.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*azyVMmpxLJFUrX-QgFZLOQ.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/de-de/@frank-cone-140140?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Frank Cone</a> on <a href="https://www.pexels.com/de-de/foto/stoff-mit-kunstlerischem-design-3573555/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><h3>Why you want to use Ray</h3><p>First of all, Windows support for Ray is in alpha, and obviously not recommended for production use. Nevertheless, when getting to learn ray, some of you may still want to install it on their Windows laptop, if you don’t prefer to use a Linux-based installation. When you take a look at the <a href="https://docs.ray.io/en/latest/installation.html">official installation instructions</a> is a breeze, not only on Linux, but also on Windows: update your Visual C++ Runtime, do a simple installation with pip, and there you go.</p><p>Except that nowadays, everybody tries to keep their python environments neatly separated, which means that instead of pip, you usually use an package manager like venv/virtualenv, pipenv, pew, or conda. And that’s where the fun begins. Using conda with Ray is technically a working option. For some of us, however, this option doesn’t work from a legal point of view. The problem is that Anaconda Inc. changed their <a href="https://www.anaconda.com/terms-of-service">terms of service</a> for the code repository that is used with conda, to require a commercial license if you’re in a business with 200 or more employees.</p><p>Since this change, many in the machine learning community have switched to other package managers. Unfortunately, basic tools like venv (which is part of the Python standard library since version 3.3) and virtualenv <a href="https://github.com/ray-project/ray/issues/13794">don’t work with Ray under Windows</a>. What makes this worse is that pipenv also uses venv under the hood, so it doesn’t work either. This excludes pretty much all of the most popular conda alternatives.</p><h3>What makes Ray difficult to use under Windows</h3><p>First of all, Windows support for Ray is in alpha, and obviously not recommended for production use. Nevertheless, when getting to learn ray, some of you may still want to install it on their Windows laptop, if you don’t prefer to use a Linux-based installation. When you take a look at the <a href="https://docs.ray.io/en/latest/installation.html">official installation instructions</a> is a breeze, not only on Linux, but also on Windows: update your Visual C++ Runtime, do a simple installation with pip, and there you go.</p><p>Except that nowadays, everybody tries to keep their python environments neatly separated, which means that instead of pip, you usually use an package manager like venv/virtualenv, pipenv, pew, or conda. And that’s where the fun begins. Using conda with Ray is technically a working option. For some of us, however, this option doesn’t work from a legal point of view. The problem is that Anaconda Inc. changed their <a href="https://www.anaconda.com/terms-of-service">terms of service</a> for the code repository that is used with conda, to require a commercial license if you’re in a business with 200 or more employees.</p><p>Since this change, many in the machine learning community have switched to other package managers. Unfortunately, basic tools like venv (which is part of the Python standard library since version 3.3) and virtualenv <a href="https://github.com/ray-project/ray/issues/13794">don’t work with Ray under Windows</a>. What makes this worse is that pipenv also uses venv under the hood, so it doesn’t work either. This excludes pretty much all of the most popular conda alternatives.</p><h3>What’s the best workaround?</h3><p>Of course, we could just forget about dependency management and use pip to directly install Ray directly into the site-packages of our Python installation. Unfortunaly, this kind of dirty hack will get you into dependency hell sooner or later, and that’s a place we definitely want to avoid. So we try to find the root cause of the problem, hoping we might discover a less clumsy workaround along the way. It turns out that a <a href="https://bugs.python.org/issue38905">bug in the Windows version of venv</a> causes the problem. So ironically, it’s not the young framework Ray that is to blame here, but a much more mature piece of software. When you go through the details of the bug, you see that it was introduced in Python 3.7.3 (and seems complex enough not to be fixed soon). You also see that venv is positively confirmed to work correctly in Python 3.6. Hence, faced with the choice of either not using a package manager at all (if conda is legally off limits), or using an older version of Python, the latter will usually be the smaller evil. Maybe you would also like to reconsider an installation under Linux as Python 3.6 is admittedly outdated.</p><h3>Hence, the solution for the Windows installation is the following (using pipenv, venv is similar):</h3><ul><li>Install some version of Python 3.6 from the official <a href="https://www.python.org/downloads/windows/">Python release download page</a>. I’d recommend 3.6.8, as it’s the latest version available for download.</li><li>Use gitbash or the Windows command line to navigate to the directoy of your Python project</li><li>Issue the command “pipenv — python 3.6.8” to create a pipenv environment that uses Python 3.6.8 (or whatever version of Python 3.6 you chose).</li><li>Do a quick “pipenv install ray” to install ray.</li></ul><p>And now it works and you’re ready to go! Take a look at the <a href="https://docs.ray.io/en/latest/auto_examples/overview.html">great tutorials on the Ray web site</a> and launch your discovery tour into the world of Ray.</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/how-to-install-ray-under-windows/"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db14681180f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/how-to-install-ray-under-windows-db14681180f7">How to install Ray under Windows</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS AI Services as Building Blocks for Intelligent Applications]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/aws-ai-services-c69f88769131?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/c69f88769131</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Timo Böhm]]></dc:creator>
            <pubDate>Thu, 31 Oct 2019 14:18:56 GMT</pubDate>
            <atom:updated>2019-10-31T15:09:39.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8OQRwsFsb7UMSuky" /><figcaption>Photo by <a href="https://unsplash.com/@joshriemer?utm_source=medium&amp;utm_medium=referral">Josh Riemer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>A Brief Overview of the Pros and Cons of AWS AI Services</h4><p>There are three different ways to integrate AI into intelligent applications:</p><ol><li>New development of provisioned infrastructure.</li><li>Development within a framework that is specifically designed for machine learning.</li><li>Outsourcing development by using AI services offered by cloud providers.</li></ol><p>This post covers the third option with reference to AWS. However, similar offerings are also available from other cloud providers.</p><h3>What are AWS AI Services?</h3><p>In sum, AWS AI services are a collection of APIs with AI functionality developed by AWS. Although there are minor differences between them, all are designed around the same basic principle: an application calls the respective API and it returns a response in JSON format.</p><p>Therefore, the developer only needs to take care of the call itself and how the response will be further used by the application. AWS takes care of further developments of the necessary algorithms, the coordination of the API calls and the provisioning of the computing resources.</p><p>This inherent scalability and modularization make AWS AI services especially interesting for serverless architectures since they match the overall design philosophy.</p><h3>When should you consider using AWS AI Services?</h3><p>As with other cloud services, you should start with a thorough cost-benefit analysis. It is crucial to consider the complete lifecycle of an intelligent application here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*wuhwUxB_EP1C7mg4lteHQQ.png" /><figcaption><em>Both the costs and benefits of intelligent applications are hard to estimate. That is why it is even more important to start with a clear analysis.</em></figcaption></figure><p>The main cost drivers when it comes to AI are initial development costs, followed by maintenance and further improvements. All AWS AI services work on a pay-per-use basis, that is they only create costs when they are called. However, pricing models between the different APIs can vary and it is worth calculating different usage scenarios during the estimation phase.</p><p>From a benefits perspective, the most important question is how central a functionality for the application is. More important functionalities probably justify additional investments in development since use-case specific adaptations create high value. These adjustments are hard or even impossible to do by using the APIs provided by AWS.</p><p><strong>Example 1:</strong> to standardize inputs, all incoming texts must be translated into English first. In this case, developing a new solution would create high costs and risks. The probability that the new approach outperforms AWS Translate is minimal. Therefore, the use of AI service is clearly preferable.</p><p><strong>Example 2:</strong> incoming images need to be sorted into business-specific categories. In most cases, this cannot be done directly via the AWS service, since it probably missed the necessary categories. Since there are a lot of powerful open-source frameworks available, the new development is the better choice.</p><p>Both examples are simplifications of real-world applications. From experience, you should expect hard discussions and engaged proponents both for new development and direct use of AI services. Therefore, a calm comparison of all available options is essential.</p><h3>What are the most important AWS AI Services?</h3><p>The number and pricing of AI services can change as fast as other cloud services, too. The current state of affairs is documented here: <a href="https://aws.amazon.com/de/machine-learning/ai-services/">https://aws.amazon.com/de/machine-learning/ai-services/</a>. To keep this post clear and concise, they are ordered by the application area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*lmpGJZffnFmjVvO0il9big.png" /><figcaption><em>The three most important AWS AI services. From left to right: AWS Comprehend, AWS Rekognition, and AWS Personalize.</em></figcaption></figure><h4>Text and Language</h4><p>From an analytical point of view, AWS Comprehend is the most important service here. It includes a variety of NLP modeling approaches, such as entity recognition or sentiment analysis.</p><h4>Images and Videos</h4><p>The main AI service concerning images and videos is AWS Rekognition. It includes tagging of videos, the classification of images as well as face detection capabilities.</p><h4>Personalized Recommendations</h4><p>AWS Personalize is especially suited for e-commerce contexts. This AI service promises to leverage personalization of webshops etc. based on the expertise Amazon accumulated over the years.</p><h3>Summary</h3><p>Using the AI services of AWS needs, especially compared to new developments, way less development effort. That is quite attractive, but it can also lead to a premature reduction of options. Just because the results of the APIs are impressive does not mean that they are the best solution for a specific use case. A deliberate decision of all possibilities is therefore crucial for the successful implementation of an intelligent application.</p><p>Let me know in the comments or on <a href="https://twitter.com/TimoBohm">Twitter</a> if this post helped you or if you want to add something. I’m also happy to connect on <a href="https://www.linkedin.com/in/timo-boehm-datascience/">LinkedIn</a>. <strong>Thanks for reading!</strong></p><p><em>Originally published at </em><a href="http://: https://www.btelligent.com/en/blog/building-blocks-for-intelligent-applications/?&amp;utm_source=Medium&amp;utm_medium=organic&amp;utm_campaign=eventExtern-awsaiservices-1910"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c69f88769131" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/aws-ai-services-c69f88769131">AWS AI Services as Building Blocks for Intelligent Applications</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural averaging ensembles for tabular data with TensorFlow 2.0]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/neural-averaging-ensembles-for-tabular-data-with-tensorflow-2-0-f28796e1289f?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/f28796e1289f</guid>
            <category><![CDATA[tensorflow2]]></category>
            <category><![CDATA[ensemble-learning]]></category>
            <category><![CDATA[tabular-data]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Allgöwer]]></dc:creator>
            <pubDate>Thu, 31 Oct 2019 12:31:22 GMT</pubDate>
            <atom:updated>2019-11-25T07:26:54.690Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*jhd2oScfMCPrdsp-.jpg" /></figure><h3>Neural networks for tabular data: ensemble learning without trees</h3><p><strong>Neural networks are applied to just about any kind of data (images, audio, text, video, graphs, …). Only with tabular data, tree-based ensembles like random forests and gradient boosted trees are still much more popular. If you want to replace these successful classics with neural networks, ensemble learning may still be a key idea. This blog post tells you why. It is complemented by a </strong><a href="https://nbviewer.jupyter.org/github/Allgoerithm/neuralaveraging/blob/master/Neural_averaging_ensembles.ipynb"><strong>notebook</strong></a><strong> in which you can follow the practical details.</strong></p><h3>Tabular data: gradient boosting rules</h3><p>In 2017 <a href="https://arxiv.org/abs/1706.02515">self-normalizing networks</a> were invented by Günter Klambauer and co-authors with the explicit aim of making neural networks fit for tabular data. Their approach was to improve dense feed-forward networks, the standard neural network architecture for tabular data, by using a new activation function. With this modification, dense feed forward networks can be trained which are much deeper than the previous limit of about four hidden layers. While self-normalizing networks work well and achieve results that are comparable with gradient boosting and random forest, they do not work well enough to break the dominance of classical ensemble methods in the field of tabular data — at least not yet. One of the reasons for this was probably that self-normalizing networks do not provide a very rich or versatile theory for tailoring the right network for a particular application. They merely enable us to go deeper than before (which of course is a large step forward anyway).</p><h3>A gem from AI winter</h3><p>Last year I gave a conference talk on self-normalizing neural networks. I was trying to popularize the idea that the time is right for tabular data modelling experts to add neural network techniques to their toolbox. I am still convinced that this is true. But only one day after I gave that talk, I had the honour and the pleasure to attend a small, intense workshop with Hans Georg Zimmermann. During this workshop, I realized that I had been looking at neural networks in a quite superficial way, lacking much of the mathematical depth and sophistication of the theories presented in the workshop. I also learned that there are much older methods for attacking tabular data than self-normalizing neural networks, methods whose development started already during AI winter. And in this case, oldies may be goldies.</p><p>It seems to me that these methods have not yet received the attention they deserve. It is questionable whether I will be able to change that with a blog post for a probably quite limited audience, but I will do my best. I will try to explain some first steps; there is more to this than fits in a single blog post. All good ideas presented here I learned from Hans Georg Zimmermann; all mistakes and faults in this text are mine. In particular, the use of embeddings below is, for better or worse, my own variant of these methods.</p><h3>Overparametrization: bug or feature?</h3><p>Although many of the details of why neural networks work so well are yet to be understood, it becomes more and more clear that they work because they are heavily overparametrized, not despite of it. To understand that, you must not look at them with the eyes of classical statistics, which would tell you that typical neural network models have way too many parameters. This is a problem indeed, but we will deal with it later. For the moment, look at the training process through the lens of optimization theory. If you do that, you will realize that these seemingly superfluous parameters protect you (or rather the training process) from getting trapped in a local minimum. And that, obviously, remedies a big worry: in deep learning, none of the convergence guarantees from classical optimization theory apply. Getting trapped in a local minimum would be sort of a default scenario, if we didn’t have overparametrization.</p><p>Now how about the problematic aspects of overparametrization? There will be not only one optimum weight configuration for our neural network, but lots of very different ones. And we can’t know which is the right one. Ensemble learning gives us a very pragmatic way out of this dilemma: Just take a few copies of your neural network, each with endowed with a different optimum weight solution, and average over them. This effectively reduces the ridiculous amount of variance generated by overparametrization. You can encode all of this in a single neural network: Take identical copies of a neural network (the weak learners) and connect each of them to the input data and an averaging neuron as the output. When you train this network, the different random initializations of each of the weak learners will make sure that they all arrive at different optimum weights when the training is over.</p><h3>A complete recipe for sizing your neural network architecture</h3><p>If you follow this argument, a neural network architecture that averages over identical copies of smaller neural networks (weak learners) is not as silly as it may look at first sight. I like to call this kind of averaging architecture a neural averaging ensemble. We haven’t talked about the weak learners yet, the building blocks of these architectures. What kind of network should we choose? Well, whatever you choose, you will have several copies of it afterwards, so it may be a good idea to keep things small and simple. The <a href="https://en.wikipedia.org/wiki/Universal_approximation_theorem">Universal Approximation Theorem</a>.</p><p>tells us just how small and simple it can get: a single hidden layer will suffice. Of course, networks with more layers are often far superior in practice. But let’s stick to this minimalistic approach for the moment. If we do, the only thing that remains to decide before we have completely specified our weak learner is the size of the single hidden layer. How many neurons do we need?</p><p>The answer is surprisingly easy: We fit a single weak learner on the training data (and for speed’s sake, we don’t need to fit it perfectly, a rather low number of epochs will suffice). We start with a low number of neurons in the hidden layer, say, 10. After training the network, we check whether any of these neurons is superfluous, i.e., its output is highly correlated to another neuron. If not, we try with a higher number (say, 20), until we have two highly correlated neurons. In this way we make sure that the weak learner is overparametrized, but not ridiculously so. In practice, you may want to repeat this procedure with several different initializations of your random number generator, to make sure your choice is robust. If in doubt, use a higher number of neurons.</p><p>The only thing that remains for a complete sizing of our architecture is the number of copies (of the weak learner) we want. If you’re a person who likes to be in control, you could choose the number of copies by using an analogous approach to the one we used above for the hidden layer: Train an ensemble with a certain number of copies, then try larger ones step by step until you have a few copies whose output is highly correlated. I encourage you to try that, and I’d be happy to hear about your results.</p><p>However, the number of weak learners in an ensemble has three properties that will enable us to take a more laid-back approach to choosing it:</p><ol><li>More weak learners make a better model (or at least one that is not worse)</li><li>The model quality as a function of the number of weak learners has a nice asymptotic behaviour in which adding more learners gives you less and less benefit the more you already have.</li><li>The parameter is quite robust: choosing the “wrong” number of copies won’t ruin your model</li></ol><p>In the light of these amenable properties, let’s take a shortcut: Choose a low number of copies (like 10) for your first experiments, and go up to something between 50 and 100 if you want to finalize things. This will usually work well. If you encounter situations in which this is not the case, I’m eager to hear about it.</p><h3>Categorical complications</h3><p>All of the above works well as long as we restrict ourselves to regression problems on purely numerical inputs. With categorical inputs or classification problems (i.e., categorical outputs), we need a few modifications to make things work in practice.</p><p>For classification, this is just the usual softmax layer (on top of each weak learner) to produce probabilities for each class. If you only have two classes, you can also use a sigmoid layer with a single neuron to just estimate the probability of one class. That is also the way I implemented it in the notebook.</p><p>Categorical inputs could be fed into the network by using one-hot encoding. This approach has well-known drawbacks (above all, a skyrocketing input dimension). Additionally, it often leads to huge weak learners when you use the above method of sizing. Fortunately, there is also a well-known remedy to this problem: <a href="https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture">Embedding layers</a>.</p><p>For each categorical input, we add an embedding to our weak learner right after the input layer. When preparing the data for the embedding layer, we must replace each category with a unique integer between 0 and the number of categories minus 1. Instead of giving each weak learner its own embedding layer, we can also let them use one shared embedding layer; the notebook enables you to experiment with both options. My impression is that usually a shared embedding layer works fine, so there is no need to bloat the model with separate embeddings.</p><p>Embeddings come at the price of additional hyperparameters: You must choose the dimensionality of the output for each of them. There are several approaches to do that: You can use randomized search together with the other parameters, you can <a href="https://forums.fast.ai/t/size-of-embedding-for-categorical-variables/42608">derive the output dimension from the number of categories</a> or you can try to just guess a number based on your intuition and some ideas on the interpretation of the data you’re using. I went for the last approach. Choosing the output dimensions is an interesting fine point, and I’m eager to hear how you deal with that and how your approach works out in practice.</p><h3>As good as gradient boosted trees</h3><p>When comparing the performance of this approach to gradient boosted trees within the length of a blog article, we are forced to take a less-than-scientific approach. To demonstrate that these methods work well in the middle of gradient boosting’s home turf, we choose a very small dataset, and one that contains lots of categorial variables. The latter is important, because tree-based methods usually shine on categorical data. Fortunately, Szilard Pafka has done a lot of gradient boosting benchmarks based on a dataset with many categorial variables. He has tested different <a href="https://github.com/szilard/benchm-ml">implementations</a> for various subsampled versions of the same dataset. The smallest one has only 10K rows, and it’s the one we will be using here, just to fight the myth of deep learning always requiring lots of data. The best test AUC in Szilard’s benchmark for the 10K dataset is 70.3 (achieved by Xgboost). Note that Szilard didn’t do an extensive grid search on the hyperparameters, but a smaller, more exploratory one. As we did even less hyperparameter tuning, comparing our results to his does not put deep learning methods at any unfair advantage. When you look at the <a href="https://nbviewer.jupyter.org/github/Allgoerithm/neuralaveraging/blob/master/Neural_averaging_ensembles.ipynb">notebook</a> you see that we achieve 69.5 with the neural network approach, so we’re roughly on the same level of performance. This optimum performance for the network is already achieved after 4 (!) training epochs, so training will even be faster than with gradient boosting.</p><h3>Try this at home!</h3><p>I hope this demonstration has whet your appetite. Of course, this is only a single example, with a single dataset. As we all know, this doesn’t prove much. So please, try this on your own data and tell me how it goes!</p><p>There is also much more where this comes from — -we have only scratched the surface of a rich theory. The techniques here can be extended in several directions, and we can even extend the analogy to classical ensemble learning further by going from averaging to boosting, producing even more accurate models. There are also specialized techniques for model transparency. I may cover some of these topics in future posts. In the meantime, please try this stuff for yourself! I’m eager to hear about your experiences.</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/neural-averaging-ensembles/?&amp;utm_source=Medium&amp;utm_medium=organic&amp;utm_campaign=dscBlog-neuralaveragingensembles-1910"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f28796e1289f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/neural-averaging-ensembles-for-tabular-data-with-tensorflow-2-0-f28796e1289f">Neural averaging ensembles for tabular data with TensorFlow 2.0</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Basic Ideas behind Recommendation Systems]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/the-basic-ideas-behind-recommendation-systems-b74e5f92f7ae?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/b74e5f92f7ae</guid>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[business-strategy]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Timo Böhm]]></dc:creator>
            <pubDate>Wed, 02 Oct 2019 10:02:28 GMT</pubDate>
            <atom:updated>2019-10-02T10:02:28.296Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4KZyKqsLhbjADrRs" /><figcaption>Photo by <a href="https://unsplash.com/@pvsbond?utm_source=medium&amp;utm_medium=referral">Peter Bond</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recommendation systems are a crucial part of every digital business model. This blog post concisely answers two foundational questions:</p><ol><li>Who should care about recommendation systems and why?</li><li>What are the primary flavors of recommendation systems? How much work is it to implement them?</li></ol><h3>What does a recommendation system deliver?</h3><p>A recommendation system targets the specific interests of consumers. Phrased differently, it prevents a premature end of a customer journey due to overload or frustration. That is why recommendation systems are crucial for enterprises with a broad range of goods or services.</p><p>It is also essential to keep in mind the customers’ usage behavior. Whereas some pages encourage extensive browsing, others are designed to identify the optimal product as quickly as possible</p><h3>Would your company benefit from introducing a recommendation system?</h3><p>Digital B2C-business models benefit most from recommendation systems since such systems directly impact their most important KPIs. An introduction of a recommendation system hugely improves the customer experience. Besides, valuable recommendations are expected by users as a standard feature. The optimization of an existing recommendation system also helps to tap into the unused potential.</p><p>In addition to these main effects, recommendation systems also have several side-effects:</p><ul><li>The development team increases its data know-how and is incentivized to dive into the actual user behavior and preferences.</li><li>Enterprises can use the created insights for further improvements both of the range of offers and the user experience.</li><li>Implemented recommendation systems can also be used as a testing tool since they can be used to channel traffic.</li></ul><h3>What are the flavors of recommendation systems?</h3><p>There are many details involved, but there are mainly two flavors when it comes to recommendation systems: <strong>item-based</strong> and <strong>consumer-based</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*L-1LVguHBy7Vw9DA.png" /></figure><h4>Option 1: Item-based approach</h4><p>The first option focuses on available products. Recommendations will hone in on similar products. “Similar” can mean many different things here. For instance, product category, pricing, or brand can define similarity. A combination of several dimensions is also possible.</p><h4>Option 2: Consumer-based approach</h4><p>Option 2 does not aim for similarities in products, but instead among consumers. The resulting recommendations may strongly reflect those under option 1, or not at all. This approach strives to model preferences and reasoning behind the consumer’s buying decisions, and less so the objective similarities between products.</p><h4>Which option best suits my situation?</h4><p>These days, legal restrictions on data access under the EU’s General Data Protection Regulation (GDPR) significantly affect one’s choices. Nevertheless, the item-based approach is an option, since one can set it up as a table and update it regularly. This makes integration in mobile websites and apps much easier. The consumer-based approach offers greater potential, depending markedly on whether you have a reliable streaming infrastructure.</p><h3>What are the first steps?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*poIT9NZDmikPmIp2.png" /></figure><p>There are three areas to evaluate before recommendation systems can be implemented:</p><ol><li>How strong is the connection between a recommendation system and the business model? Is it a central component or a nice-to-have? How large is the added value for customers?</li><li>How much effort is needed to integrate a recommendation system into the current infrastructure? Is the necessary data available and is it legal to use it for this purpose?</li><li>Does your company have the necessary data science and machine learning engineering skills? Is there a team ready to take on these tasks? Is it necessary to establish new organizational structures?</li></ol><p>If these three questions are answered, the actual work on a recommendation system can start.</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/filter/the-basic-ideas-behind-recommendation-systems/?&amp;utm_source=Medium&amp;utm_medium=organic&amp;utm_campaign=dscBlog-recommendationsystems-1910"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b74e5f92f7ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/the-basic-ideas-behind-recommendation-systems-b74e5f92f7ae">The Basic Ideas behind Recommendation Systems</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reinforcement Learning, Bayesian Statistics, and Tensorflow Probability: a child’s game — Part 2]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/reinforcement-learning-bayesian-statistics-and-tensorflow-probability-a-childs-game-part-2-94526dddadd9?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/94526dddadd9</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <category><![CDATA[markov-chain-monte-carlo]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[tensorflow-probability]]></category>
            <dc:creator><![CDATA[Michael Allgöwer]]></dc:creator>
            <pubDate>Tue, 03 Sep 2019 09:12:18 GMT</pubDate>
            <atom:updated>2019-09-03T09:12:17.944Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reinforcement Learning, Bayesian Statistics, and Tensorflow Probability: a child’s game — Part 2</h3><p>In the first part, we explored how Bayesian Statistics might be used to make reinforcement learning less data-hungry. Now we execute this idea in a simple example, using Tensorflow Probability to implement our model.</p><h4>Rock, paper, scissors</h4><p>When it comes to games, it is difficult to imagine something simpler than rock, paper, scissors. Despite the simplicity, googling the game reveals a remarkable body of literature. We want to use Bayesian Statistics to play this game and exploit the biases of a human opponent. We will build a model of our opponent’s mind and choose a move which beats it. The most important parts of the code are shown and discussed in this post. If you want to execute the code, use the <a href="https://gist.github.com/Allgoerithm/b2b327f025585d4bbeabc48a85a7ac47">full notebook</a>. As we want to keep things straightforward, we deal only with the most elementary of biases: We want to model the frequency with which our opponent chooses each of the moves.</p><h4>Telling a tale of data generation</h4><p>One of the nice features of the Bayesian approach is that you can come up with a model by just describing the data generating process step by step. Let’s try that for our game:</p><ul><li>Somewhere, deeply hidden in a human mind, there’s a secret probability distribution over the three moves that are possible in this game.</li><li>Governed by this distribution, our human opponent chooses a move.</li><li>This process is repeated over and over, and we count the number of occurrences of rock, paper, and scissors. This is the data we want to use to uncover the secret probability distribution.</li></ul><p>Now let’s translate this into a Bayesian model. It is easiest to start with the last step, because it is related to the data we want to use. In this case, the data is simple: It’s just the counts of rock, paper and scissors in the moves of our human opponent from past rounds of the game. When you draw a ball from an urn which contains balls with several colours, put it pack, draw another one, and repeat that, the number of balls you get for each colour is governed by a so-called multinomial distribution.</p><p>So, when we say that the counts of each of the three moves are drawn from a multinomial distribution, this is just a fancy way of claiming that they behave like drawing balls from the urn. This also implies that each of the rounds being played is independent of all other rounds. A human player will often employ strategies which lead to dependencies among the rounds, like being hesitant to play the same move more than, say, two or three times in a row. Hence, we already know that independence will not always be perfectly fulfilled. But that doesn’t necessarily mean it’s a bad idea to use it. It could still be a good assumption, if it enables us to play well.</p><h4>Let’s get Bayesian, baby</h4><p>Up to this point, there’s nothing specifically Bayesian about our model. Using a multinomial distribution in this context is pretty much a no-brainer for any statistician, even for those who distance themselves passionately from Bayesian approaches.</p><p>Genuinely Bayesian is the next step, which requires us to specify which <em>prior knowledge</em> we may want to incorporate into our model regarding the likelihoods of rock, paper and scissors. We do that by specifying a probability distribution that yields combinations of probabilities for rock/ paper/scissors. The so-called <a href="https://towardsdatascience.com/dirichlet-distribution-a82ab942a879">Dirichlet distribution</a> is fine for that. If you’ve never heard of the Dirichlet distribution, don’t worry. For our purposes we only need to know that we’re going to use the version that has three parameters, and each of the three parameters will correspond to one of the outcomes of rock/paper/scissors. If one of the parameters (say, the one for paper) is greater than another (e.g., the one for rock), then paper will be more likely than rock under the distribution. If all three parameters are equal to 1, the Dirichlet distribution becomes a uniform distribution. This is the case which we are going to use for the prior. It means that we don’t have any knowledge about which outcome might be more likely than another, and therefore we use a so-called <em>uninformative prior,</em> which doesn’t favour any outcome.</p><p>Now our model is ready. It has two steps: In the first one, probabilities for rock, paper and scissors are drawn from a Dirichlet distribution. In the second step, these probabilities are used in a multinomial distribution which generates the counts for each of the moves.</p><h4>Coding the model</h4><p>When we translate the ideas from the last paragraph into code, the result looks like <a href="https://gist.github.com/Allgoerithm/70e5ca1cbc9f7e69a14abc13b85a2b98">this</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d545840e3b3f8b5a37b1dd109e454ba/href">https://medium.com/media/2d545840e3b3f8b5a37b1dd109e454ba/href</a></iframe><p>The first thing you may note is that we’re not calculating a probability here, but the logarithm of a probability. This has purely numerical reasons: The probabilities we work with may be tiny in some cases, tiny enough to cause numerical problems. When we use log probabilities instead, we make better use of the available range of numbers in a floating point value, and numerical problems become much less likely. Working with log probabilities is as simple as working with probabilities directly. You only need to keep in mind that whenever you would multiply probabilities, the corresponding log probabilities must be added.</p><p>Now our overall aim in this step is to write a function that returns the joint log probability of a data point (i.e., three counts, one for rock, one for paper, one for scissors) and the corresponding parameter values (here it suffices to have probabilities for rock and paper, the scissors probability can then be calculated). Now the rest is easy: We use the Dirichlet distribution to calculate the log probability of our probability parameter values, the multinomial distribution to calculate the log likelihood of the count values, and then we add the two, which gives us the joint log probability of this data occurring together with these probability parameters (p_rock and p_paper). And that’s it! We’ve coded our Bayesian model.</p><h4>Estimating parameter values</h4><p>I just claimed we have a model. But how do you estimate the model’s parameters (specifically, p_rock and p_paper), when all you have is some data and a function for the joint log probability? Fortunately, there is some heavy machinery built into TensorFlow Probability for exactly this job. It’s called Markov chain Monte Carlo, and we’ll use the latest and greatest variant of this method, which goes by the name of Hamilton Monte Carlo. It enables us to sample from the posterior distribution of our model, i.e. the distribution that is derived from the prior by incorporating the information given in the concrete data. And if our sample is large enough, it basically enables us to know everything about that distribution: the shape, the average, the median, the modes, etc. Hamilton Monte Carlo is one of these ideas that sound crazy until you notice how well they work. The intuitive idea is that you imagine the probability you want to sample from as some high-dimensional landscape composed of mountains (high probability) and valleys (low probability). Now you let a ball roll over this surface, and wherever it rolls, it takes samples of the distribution at regular time intervals. But as the ball will gain speed when rolling downhill, it will be much faster in the valleys (and hence, take less samples there) than on the mountains. Surprisingly, this can actually be implemented in a way that works. If you’re interested in more details, read <a href="https://jeremykun.com/2015/04/06/markov-chain-monte-carlo-without-all-the-bullshit/">Jeremy Kun’s great introduction to Markov Chain Monte Carlo in general</a> and <a href="http://elevanth.org/blog/2017/11/28/build-a-better-markov-chain/">Richard McElreath’s blog post</a> on Hamilton Monte Carlo in particular. In our case, <a href="https://gist.github.com/Allgoerithm/8225b69f33aff56e56e47687dfc9e6bb">this piece of code</a> invokes the Hamilton Monte Carlo sampling.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6338afc043d5649c0482a4182d65a1d/href">https://medium.com/media/d6338afc043d5649c0482a4182d65a1d/href</a></iframe><p>We first define some fictional observed data. In our case, we assume we’ve seen rock five times, but paper and scissor haven’t been chosen yet. Then we do some technical preparation of the Markov Chain and, finally, sample from the chain. When we plot the distribution of samples for p_rock (figure 1, on the left), we see that the median is at 0.8, which is quite reasonable given the fact that the data we threw in is a count of 5 for rock, and zeros for paper and scissors. The plot also shows that there is still substantial uncertainty about the exact value of p_rock. The plots for p_paper and p_scissors (figure 1, in the middle and to the right) show that, as expected, these values are rather close to zero. Now that we’ve estimated the values, we could directly use them for reinforcement learning. But let’s first check that our simulation went right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*uYJbYZHAunhXF5ym.png" /></figure><p>Figure 1</p><h4>TensorFlow 2 with TensorFlow Probability</h4><p>If you have tried the Markov chain simulation yourself, you will have noticed that the corresponding cell in the notebook takes about 17 minutes to execute. The reason for this is that it is being executed in eager mode. Tensorflow 2 has execution mechanisms that work similar to the graph mode in TensorFlow 1. However, I could not find out how they can be combined with TensorFlow Probability in order to get a speedup in the Markov chain simulation. As far as I understand, the way we already use “tf.function” in our code (once as a decorator and once as a function) should do the job. But currently it does not improve the performance. The same code (with slight modifications for graph mode) executes roughly 10x faster in TensorFlow 1. I expect this problem to be solved soon. Maybe someone reading this has an idea, maybe it’s also a matter of waiting for the next version of TensorFlow Probability. Until then, I rather put up with the bad performance than presenting the notebook in Tensorflow 1, which will be legacy soon.</p><h4>Mathemagically checking our results</h4><p>Now we’ve used this big black box called Hamilton Monte Carlo for the first time, and it surely would be nice to be able to check that it generates correct results. Fortunately, we are in a very special position: Usually, parameter estimation in Bayesian models needs numerical methods like Hamilton Monte Carlo. But as we kept things very, very simple, we are in one of the very, very few situations in which there is a simple mathematical formula for the parameters. Hence, we have a handy way of double-checking the Monte Carlo results: If we have a Dirichlet prior with parameters (1, 1, 1) and data (r, p, s) (where r/p/s is the number of rock/paper/scissors observations), the corresponding posterior (the distribution we sampled from using Hamilton Monte Carlo) is a Dirichlet(1 + r, 1 + p, 1 + s) distribution. When you compare the corresponding plots of the posterior (figure 2) with the ones we’ve already generated, you’ll notice that they are very similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*EzdYJ4q81Bj3XjSF.png" /></figure><p>Figure 2</p><h4>Reinforcement learning: It’s all fun and games</h4><p>Now it’s time to build our model into a small, reinforcement-learning-powered game of rock, paper, scissors. As the game is more fun when responses are calculated quickly, we will use the mathemagical shortcut from the last paragraph for the calculation of the posterior distribution. <a href="https://gist.github.com/Allgoerithm/b144021fd3ee97edff8e3d0feb6b2c89">This gist</a> contains the main part of the code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97c5964ae91d3758fd8ca6676492faa5/href">https://medium.com/media/97c5964ae91d3758fd8ca6676492faa5/href</a></iframe><p>It is being called by the UI code whenever we press one of the buttons in the game. The argument “button_info” is either “rock”, “paper”, or “scissors”. Again, refer to the <a href="https://gist.github.com/Allgoerithm/b2b327f025585d4bbeabc48a85a7ac47">full notebook</a> if you want to try the game while reading.</p><p>The basic idea is that we will use our model to infer the probabilities with which our human opponent chooses each of the moves and update the data and probabilities after each round. Then we draw a likely move of our opponent from this distribution. Calculating our move is then easy: If our opponent chooses rock, we choose paper, if they choose paper, we choose scissors, etc. Hence, we build a randomized strategy that mirrors the actual frequencies with which our opponent chooses each of the moves. The strategy utilizes not only a point estimate, but a full distribution of the likelihoods of each move. You can see how these distributions change during the game. They are shown in a small plot which updates after each move. It is interesting to see how they change, but knowing these distributions gives the human opponent an unfair advantage. You can therefore switch them off by setting “show_plot = False” at the beginning of the cell.</p><h4>Where do we go from here?</h4><p>If you’ve made it to this final section, you may (in the best case) have the feeling that all this Bayesian and Markov chain Monte Carlo stuff is intriguing and useful. You may also have the feeling that I skipped over a lot of important detail (which is true). There are some exceptionally well-written books that can fill in the blanks, and I recommend you try one of those. For those who want to approach things from a programming perspective, Cam Davidson-Pilon’s book “ <a href="https://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/#tensorflow">Bayesian Methods for Hackers</a>” is a great start. It is available for free on Github, and all the examples have recently been ported to TensorFlow probability. If you’d like to take a slightly more statistics-minded perspective, Richard McElreath’s “ <a href="https://xcelab.net/rm/statistical-rethinking/">Statistical Rethinking</a> “ is awesome. The examples are not (yet?) available in TensorFlow Probability. Read the book anyway. Richard McElreath has a marvellous way of demonstrating the simplicity of concepts that sound esoteric when you read about them elsewhere. I should probably recommend some literature on reinforcement learning as well, but I haven’t yet come across a book that I like as much as the ones I just mentioned. I’m curious to hear about your reinforcement learning favourites, and about your adventures when you try all this stuff. Please, feel free to contact me for further discussions!</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/reinforcement-learning-bayesian-statistics-part-2/?&amp;utm_source=Medium&amp;utm_medium=organic&amp;utm_campaign=dscBlog-Rockpaperscissors2-1909"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94526dddadd9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/reinforcement-learning-bayesian-statistics-and-tensorflow-probability-a-childs-game-part-2-94526dddadd9">Reinforcement Learning, Bayesian Statistics, and Tensorflow Probability: a child’s game — Part 2</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are you data-driven? Or is it the noise that drives you?]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/are-you-data-driven-or-is-it-the-noise-that-drives-you-842ea6d326be?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/842ea6d326be</guid>
            <category><![CDATA[the-signal-and-the-noise]]></category>
            <category><![CDATA[nassim-nicholas-taleb]]></category>
            <category><![CDATA[fooled-by-randomness]]></category>
            <category><![CDATA[data-driven]]></category>
            <category><![CDATA[immanuel-kant]]></category>
            <dc:creator><![CDATA[Michael Allgöwer]]></dc:creator>
            <pubDate>Wed, 21 Aug 2019 10:04:09 GMT</pubDate>
            <atom:updated>2019-08-21T10:04:09.121Z</atom:updated>
            <content:encoded><![CDATA[<p>Being data-driven is one of the hallmarks of a modern organization. In practice, as opposed to management theory, data always comes with a certain measurement error. It is never 100 percent accurate. Everybody knows this, but only very few people act on it. This blog article invites you to find out what happens when you take measurement error seriously. Let us take the red pill together.</p><h4>Data-driven decisions: a commendable example</h4><p>Imagine the following scenario, fictitious, but not unrealistic: A large company routinely uses data on the size of the markets they are operating in. They buy market research data that covers revenues of markets around the globe, broken down into detailed product categories. This data is being used throughout the company to inform key strategic decisions on sales approach, production sites, and other important topics. The most widely used KPI is the percentage growth of revenue compared to the previous year. This number may be looked at for the overall business, or for smaller product and country segments, depending on the decision it is used for. Everybody is very happy to have these hard facts and proud to base their decisions on data, not gut feeling.</p><h4>Agile decisions, driven by data</h4><p>When you talk to people in the company, they tell you how much they’ve learnt from this treasure trove of data. You talk to Bob. He’s a country manager, and he tells you: “Before we had this data, I thought I knew my business. The countries I’m responsible for are mature markets, and our industry is a very stable one. So, basically, everything grows at more-or-less the same rate every year, I thought. But then I saw the real market data for the first time, and I was in for a surprise! There is no steadiness in the markets. They’re moving all the time. At first, it was a shock. I realized I had to change the way I manage things. I always tried to keep a steady hand. But in a reality of moving markets, you can’t stand still. I’m taking decisions much more rapidly now. And I am prepared to change them quickly. We have all become a lot more agile around here. Some of us struggle with the loss of predictability and security. But it’s important to move quickly if you want to survive.” Bob looks proud when he says that. He also looks exhausted. The new numbers have arrived last week, and they show a sudden downturn in the largest of the markets Bob is responsible for. Layoffs are discussed, and Bob is not sure whether they can avoid them.</p><h4>Data-driven or noise-haunted?</h4><p>When you ask Bob why the numbers are so bad in that country, he shrugs. “Honestly, I haven’t figured that out yet. It’s not the overall economy, you know. People still have enough money in their pockets. Before the data came in, I would have assumed that we’ll see maybe a 5% growth. I assumed 5% for this country most of the time before we had the actual data, you know. It’s a mature market, but also a rich one in which people like to buy new and better stuff often.” And then you do it: You swallow the red pill. It enables you to see not only the data, but also the error contained in it. And you begin to wonder: This is market research data, right? It’s produced from surveys being sent out to the companies in the industry. What’s a reasonable error for this kind of thing? It’s hard to guess without knowing the details of the data acquisition, but 2% is certainly on the optimistic side. What if Bob is actually right, and in reality, this market grows by a steady 5 % each year? What would that look like when you see it through the distorted lens of a 2% measurement error? You open your laptop and <a href="https://gist.github.com/Allgoerithm/55187359caf0b2d795e530b4268e35af">do a quick simulation</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*11yZuRD8nvlWLWXL.png" /></figure><h4>Fooled by randomness</h4><p>The simulation results are startling (see figure below). Although we know the real growth rate in our simulation is 5%, and the measurement error is only 2%, the observed growth rates fluctuate wildly, from somewhere near 3% to over 8%. This is not an extreme result caused by an unlucky choice of start values for the random generator. It is quite representative as a normal simulation run, as can be verified by playing with the start value in the notebook. So, what happens here? The measurement error has only a moderate effect on the absolute figures, as you can see in the lower left panel of the figure. But the growth rate perspective magnifies the errors and results in an erratic curve. If you base your decisions on this data, you will be haunted by noise: your decisions will be as erratic as the curve. Calling it agile won’t make it any better.</p><h4>Don’t believe a statistic you haven’t understood yourself</h4><p>So, what can we do? First of all, it’s important to understand that this kind of over-interpretation happens frequently. It is by no means limited to growth rates. <a href="https://www.linkedin.com/in/nassim-nicholas-taleb/">Nassim Nicholas Taleb’s</a> “Fooled by Randomness” contains many more examples, and it is a pleasurable read by a highly cultured author. But the solution to handling this kind of problem is much older. It comes from 18 thcentury philosopher <a href="https://en.wikipedia.org/wiki/Immanuel_Kant">Immanuel Kant</a>, the most important thinker of the enlightenment. He chose the old Latin phrase “Sapere aude!” as his motto and translated it as “Dare to think for yourself!”.</p><h4>Sapere aude!</h4><p>And that is what we need to do: Use data only after we’ve understood it ourselves, including its flaws and limitations. Sometimes, this means that you just can’t use the data in the way you would like to. Find other ways, or better data, but never give in to the temptation of just ignoring the error.</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/are-you-data-driven-or-is-it-the-noise-that-drives-you/?&amp;utm_source=Medium&amp;utm_medium=organic&amp;utm_campaign=dscBlog-areyoudatadriven-1908"><em>https://www.btelligent.com.</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=842ea6d326be" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/are-you-data-driven-or-is-it-the-noise-that-drives-you-842ea6d326be">Are you data-driven? Or is it the noise that drives you?</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reinforcement Learning, Bayesian Statistics, and Tensorflow Probability: a child’s game (part 1)]]></title>
            <link>https://medium.com/b-telligent-data-science-ai/reinforcement-learning-bayesian-statistics-and-tensorflow-probability-a-childs-game-part-1-c7435827de88?source=rss----bc8ff6d8f70a---4</link>
            <guid isPermaLink="false">https://medium.com/p/c7435827de88</guid>
            <category><![CDATA[tensorflow-probability]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Allgöwer]]></dc:creator>
            <pubDate>Wed, 21 Aug 2019 10:03:41 GMT</pubDate>
            <atom:updated>2019-08-21T10:03:40.913Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PPInMPfQethObRZz8vq9Q.jpeg" /></figure><p>Reinforcement learning has a bad reputation for being extremely data-hungry — so data-hungry it can only realistically be trained in simulation-generated data, e.g. in a computer game. We discuss how this can be cured using Bayesian Statistics, using an easily accessible small example. In the second part of this blog series, we see how this can be done in practice using TensorFlow Probability, a hot new tool from Google.</p><h4>What’s this Bayes stuff all about?</h4><p>In a recent <a href="https://www.datacamp.com/community/podcast/election-forecasting-polling">podcast interview</a>, Andrew Gelman, a leading researcher and practitioner in Bayesian Statistics, characterizes the Bayesian way of working like this: “There are two approaches to statistics. One (…) is to make very minimal assumptions, and the other is to make maximal assumptions.” The latter is true for Bayesian statistics, he then explains. This doesn’t sound attractive, right? Many in the data science community are used to thinking of assumptions as the dirty secret that you need for your models to work, but which also makes you vulnerable to errors.</p><h4>A dirty secret, turned into a modelling tool</h4><p>The Bayesian approach to assumptions is very different: Instead of trying to avoid them, they are embraced as modelling tools. Bayesian modelling is very flexible in accommodating domain knowledge, which is turned into an integral part of the model calculations. This achieves two things at once: It is much easier to make use of knowledge about the problem domain, and to do it in a well-documented and transparent manner. It is also much easier to check and modify your assumptions when they’re part of the model itself. Doing a lot of checks is crucial to the Bayesian approach, minimizing the risk of errors.</p><h3>Reinforcement learning: the strange new kid on the block</h3><p>If Bayesian statistics is the black sheep of the statistics family (and some people think it is), reinforcement learning is the strange new kid on the data science and machine learning block. It employs many of the familiar techniques from machine learning, but the setting is fundamentally different. You don’t follow the usual ritual of taking a big bunch of data, splitting it into partitions, train, evaluate and improve your model. The data your model works with in reinforcement learning is not some entity that is separate from the model itself. Instead, your model must choose from a set of actions, and gets a reward depending on this choice. Then it chooses the next action, gets the next reward, and so on, with your model trying to maximize the reward. Hence, data is not given. It is being produced while the model interacts with its environment.</p><h3>Reinforcement Learning and Bayesian statistics: a child’s game</h3><p>Let’s try these abstract ideas and build something concrete. We will stay in the reinforcement learning tradition by using a game, but we’ll break with tradition in other ways: the learning environment will not be simulated. It will be the interaction with a real human like you, for example. As this is intended to be as simple as possible, the game we use will be the childhood’s classic rock, paper, scissors. Game theory says this game has a single equilibrium in which both players choose their actions uniformly at random. In plain English: you can’t do better than choosing randomly. But also, game theory makes strong assumptions, and they are rarely fulfilled when humans are involved. Humans are not good at being truly random, and so it is interesting to design a reinforcement learning agent that exploits the biases of its human counterpart.</p><h3>TensorFlow Probability, practical Bayesian statistics, rock, paper, and scissors</h3><p>Stay tuned for the next part, where we…</p><ul><li>…wrap the gift paper off our new toy, TensorFlow Probability.</li><li>…build a Bayesian model.</li><li>…venture into to the dark art of mathemagic.</li></ul><p>…get used to losing at rock, paper, scissors against our computer.</p><p><em>Originally published at </em><a href="https://www.btelligent.com/en/blog/reinforcement-learning-bayesian-statistics-part-1/"><em>https://www.btelligent.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7435827de88" width="1" height="1" alt=""><hr><p><a href="https://medium.com/b-telligent-data-science-ai/reinforcement-learning-bayesian-statistics-and-tensorflow-probability-a-childs-game-part-1-c7435827de88">Reinforcement Learning, Bayesian Statistics, and Tensorflow Probability: a child’s game (part 1)</a> was originally published in <a href="https://medium.com/b-telligent-data-science-ai">b.telligent Data Science &amp; AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>