<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 <title>Your Title - data-newsletter</title>
 <link href="http://example.com/tag/data-newsletter/index.xml" rel="self"/>
 <link href="http://example.com/tag/data-newsletter.html"/>
 <updated>2026-06-20T23:50:25-03:00</updated>
 <id>http://example.com/tag/data-newsletter.html</id>
 <author>
   <name>Author Here</name>
 </author>
 
 <entry>
   <title>Podcast Episode Overview: What Machine Learning Engineers need to Know</title>
   <link href="http://example.com/entries/podcast-episode-overview-what-machine-learning-engineers-need-to-know"/>
   <updated>2018-04-23T20:41:27-03:00</updated>
   <id>http://example.com/entries/podcast-episode-overview-what-machine-learning-engineers-need-to-know</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;The original podcast episode can be found here: &lt;a href=&quot;https://www.oreilly.com/ideas/what-machine-learning-engineers-need-to-know&quot;&gt;O&amp;#39;Reilly Media: What Machine LEarning Engineers need to know&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You may have noticed job ads regarding a position called Machine Learning Engineer (&lt;strong&gt;MLE&lt;/strong&gt;). You may have wondered what it is; this is a new term so there&amp;#39;s a bit of confusion around it.&lt;/p&gt;

&lt;p&gt;In this episode, Ben Lorica interviewed two people on this topic. They discussed whether it&amp;#39;s actually a thing or just a fad and in which cases it makes sense to hire (or be) a Machine Learning Engineer.&lt;/p&gt;

&lt;h2 id=&quot;what-are-mles&quot;&gt;What are MLEs&lt;/h2&gt;

&lt;p&gt;There&amp;#39;s no consensus as of now.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Most people think of them as &lt;strong&gt;a hyper-specialized role&lt;/strong&gt;, someone whose sole attribution is that of putting ML systems in production, therefore bridging the semantic gap between data scientists and data engineers.&lt;/p&gt;

&lt;p&gt;The rationale is that they are needed because data scientists aren&amp;#39;t suited for writing the systems side of products and data engineers lack the necessary skill to do that as well.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;quot;I see a Machine Learning Engineer as someone who knows enough machine learning to get a product out; but they still need help from a data scientist for fine-tuning.&amp;quot;. &lt;strong&gt;Ben Lorica&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, some people think of Machine Learning Engineers as a &lt;strong&gt;generalist role&lt;/strong&gt; (much like Full-Stack Engineers in the world of Web Development), i.e. someone who knows enough about the whole data science pipeline to be able to get a working product out in the street.&lt;/p&gt;

&lt;p&gt;In other words, someone who knows some data science, some data engineering and some general software engineering to be able to work on all parts of the product.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;domain-expertise&quot;&gt;Domain expertise&lt;/h2&gt;

&lt;p&gt;While the data scientist is the role that&amp;#39;s closer to the actual business problems to be solved, Machine Learning Engineers &lt;strong&gt;are expected to&lt;/strong&gt; be able to better translate business objectives to system engineers and programmers.&lt;/p&gt;

&lt;h2 id=&quot;role-of-uncertainty&quot;&gt;Role of uncertainty&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s been said that engineers have, in general, difficulty with dealing with the ambiguity and uncertainty common in many businesses, above all those where data science permeates the decision-making process.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;quot;If you just have pure risk, you buy insurance. But uncertainty is where you&amp;#39;re going to find the upside.&amp;quot; &lt;strong&gt;Paco Nathan&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once again, &lt;strong&gt;MLEs&lt;/strong&gt; are expected to bridge the gap between the precise definitions needed in systems engineering with softer and more abstract notions from the data science world (think likelihoods, confidence intervals and continuous distributions).&lt;/p&gt;

&lt;h2 id=&quot;pipeline-maturity&quot;&gt;Pipeline maturity&lt;/h2&gt;

&lt;p&gt;The question of whether MLEs are an actual needed role or not will probably depend a lot on what &lt;strong&gt;scale&lt;/strong&gt; you are working at and how &lt;strong&gt;mature&lt;/strong&gt; your data pipeline is.&lt;/p&gt;

&lt;p&gt;If you have a mature pipeline (e.g. model monitoring, automation, off-the-shelf feature stores, smooth and well-tested data engineering processes) then having an MLE (in the sense of someone who is just focused on operationalizing models) may make sense because there&amp;#39;s actual demand for that specialized role.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;quot;The scramble to get to the point of having a feature store; that&amp;#39;s the game. Until you get to that point, your models are very ad hoc.&amp;quot; &lt;strong&gt;Paco Nathan&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On the other hand, if you work at a small startup, it probably is overkill to have someone focused on just productionizing ML systems (unless you think of MLEs as generalist engineers), and it hints at a dysfunctional team.&lt;/p&gt;

&lt;h2 id=&quot;my-2-cents&quot;&gt;My 2 cents&lt;/h2&gt;

&lt;p&gt;I would add that &lt;strong&gt;building tools&lt;/strong&gt; (be it shell scripts, command-line applications or web apps) is also a very important part of data science work in general and MLEs could be just the role to help with that. &lt;/p&gt;

&lt;hr&gt;

&lt;h2 id=&quot;quotes&quot;&gt;Quotes&lt;/h2&gt;

&lt;p&gt;&amp;quot;I see a Machine Learning Engineer as someone who knows enough machine learning to get a product out; but they still need help from a data scientist for fine-tuning.&amp;quot; &lt;strong&gt;Ben Lorica&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;quot;First make your batch processes solid, then move into streaming data.&amp;quot; &lt;strong&gt;Jesse Anderson&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;quot;The scramble to get to the point of having a feature store; that&amp;#39;s the game. Until you get to that point, your models are very ad hoc.&amp;quot; &lt;strong&gt;Paco Nathan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;quot;If you just have pure risk, you buy insurance. But uncertainty is where you&amp;#39;re going to find the upside.&amp;quot; &lt;strong&gt;Paco Nathan&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.oreilly.com/ideas/what-are-machine-learning-engineers&quot;&gt;What are machine learning engineers? (2017)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.oreilly.com/ideas/what-machine-learning-engineers-need-to-know&quot;&gt;What machine learning engineers need to know (2018)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Package a Python Project and Make it Available via pip install: Simple Example</title>
   <link href="http://example.com/entries/package-a-python-project-and-make-it-available-via-pip-install-simple-example"/>
   <updated>2017-11-15T21:46:00-02:00</updated>
   <id>http://example.com/entries/package-a-python-project-and-make-it-available-via-pip-install-simple-example</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Here is an example project built following the instructions on this post: &lt;a href=&quot;https://github.com/queirozfcom/python-ds-util&quot;&gt;Python Data Science Utils&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For more information on what terms like pip, virtualenv, etc., mean see &lt;a href=&quot;http://queirozf.com/entries/python-environment-cheatsheet&quot;&gt;Python Environment Cheatsheet&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;sample-setup-py-file&quot;&gt;sample setup.py file&lt;/h2&gt;

&lt;p&gt;File &lt;code&gt;setup.py&lt;/code&gt; is the most important configuration file for your project. Here is an example to get you started:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;c&quot;&gt;# -*- coding: utf-8 -*-&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;setuptools&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;README.md&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;r&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;long_description&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;setuptools&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;myproject&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0.0.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                        &lt;span class=&quot;c&quot;&gt;# Update this for every new version&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Your name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;author_email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;your@email.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;long description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;long_description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;long_description&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;long_description_content_type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/markdown&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;install_requires&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;                      &lt;span class=&quot;c&quot;&gt;# Add project dependencies here&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;pandas&amp;gt;=0.20.0&quot;&lt;/span&gt;                    &lt;span class=&quot;c&quot;&gt;# example: pandas version 0.20 or greater                          &lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;                                             
    &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://github.com/your/github/project&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  
    &lt;span class=&quot;n&quot;&gt;packages&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setuptools&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find_packages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;classifiers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;                                 &lt;span class=&quot;c&quot;&gt;# Classifiers help people find your &lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;Programming Language :: Python :: 3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;    &lt;span class=&quot;c&quot;&gt;# projects. See all possible classifiers &lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;License :: OSI Approved :: MIT License&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# in https://pypi.org/classifiers/&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&quot;Operating System :: OS Independent&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;   
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;project-structure&quot;&gt;Project Structure&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;project-name/        &amp;lt;--- project name, does not need to match the inner name
│             
├── myproject        &amp;lt;--- module name, this is the name you'll use in &quot;import&quot;                   
│   ├── __init__.py  &amp;lt;--- init file must be here, even if your project is Python 3 only
│   └── module.py    &amp;lt;--- submodules
│ 
├── LICENSE          &amp;lt;--- optional but recommended  
│ 
├── README.md
│ 
└── setup.py         &amp;lt;--- package information. name, author, version, and DEPENDENCIES    
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;package-the-project&quot;&gt;Package the project&lt;/h2&gt;

&lt;p&gt;To package the project, run &lt;code&gt;python setup.py sdist bdist_wheel&lt;/code&gt; (preferably under a virtualenv):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;(test-venv)$ python setup.py sdist bdist_wheel
running sdist
running egg_info
creating myproject.egg-info
writing requirements to myproject.egg-info/requires.txt
...
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;After running the packaging commands&lt;/strong&gt;, your project should now look like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;project-name/
│ 
├── build
│   ├── bdist.linux-x86_64
│   └── lib
│       └── myproject
│           ├── __init__.py
│           └── module.py 
├── dist                                     &amp;lt;--- this is the directory that
│   ├── myproject-0.0.1-py3-none-any.whl          will get uploaded to pypi
│   └── myproject-0.0.1.tar.gz
│ 
├── LICENSE
│ 
├── myproject
│   ├── __init__.py
│   └── module.py
│ 
├── myproject.egg-info
│   ├── dependency_links.txt
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   └── top_level.txt
│ 
├── README.md
│ 
└── setup.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;upload-project-to-pypi&quot;&gt;Upload project to PyPi&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Trying to upload the &lt;code&gt;myproject&lt;/code&gt; project will fail because someone has already created a project on PyPi with that name!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To upload the project you need a tool called &lt;code&gt;twine&lt;/code&gt;, which can be installed with pip:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;(test-venv)$ pip install twine
Collecting twine
...
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At this point, you should &lt;strong&gt;register an account&lt;/strong&gt; on &lt;a href=&quot;https://pypi.org/account/register/&quot;&gt;pypi.org&lt;/a&gt; so that you can upload packages.&lt;/p&gt;

&lt;p&gt;After you created your account, you can upload the packaged files using: &lt;code&gt;twine upload dist/*&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The error message is expected because the name already exists. You should pick a unique project name.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;(test-venv)$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: xxxxx
Enter your password: 
Uploading myproject-0.0.1-py3-none-any.whl
100%|████████████████████████████████████████████████████████| 4.52k/4.52k [00:00&amp;lt;00:00, 5.46kB/s]
HTTPError: 403 Client Error: The user 'xxxxx' isn't allowed to upload to project 'MyProject'. 
See https://pypi.org/help/#project-name for more information. for url: https://upload.pypi.org/legacy/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt; After uploading the project (as above), anyone can install your project &lt;strong&gt;via pip&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h2&gt;

&lt;h3 id=&quot;cant-import-module&quot;&gt;Can&amp;#39;t import module&lt;/h3&gt;

&lt;p&gt;If you can&amp;#39;t import the module you just uploaded, make sure you have an &lt;code&gt;__init__.py&lt;/code&gt; file as in the instructions, &lt;strong&gt;even if your project is full Python 3&lt;/strong&gt;! &lt;/p&gt;

&lt;h3 id=&quot;module-pkg_resources-has-no-attribute-iter_entry_points&quot;&gt;Module &amp;#39;pkg_resources&amp;#39; has no attribute &amp;#39;iter_entry_points&amp;#39;&lt;/h3&gt;

&lt;p&gt;Force reinstall &lt;code&gt;setuptools&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-&quot; data-lang=&quot;&quot;&gt;(venv)$ pip install --upgrade --force-reinstall setuptools
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;hr&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/creation.html&quot;&gt;The Hitchhiker&amp;#39;s Guide to Packaging&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Scaling Data Teams</title>
   <link href="http://example.com/entries/data-teams"/>
   <updated>2017-10-09T07:01:26-03:00</updated>
   <id>http://example.com/entries/data-teams</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Original content: &lt;a href=&quot;https://softwareengineeringdaily.com/2017/06/15/data-teams-with-rya-sciban/&quot;&gt;Data Teams with Rya Sciban on SE Daily Podcast&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Interesting podcast episode on Software Engineering Daily, where the hosts talk about what specific needs data teams have and what changes when you go from small-scale to large-scale data science.&lt;/p&gt;

&lt;h2 id=&quot;5-needs-of-data-teams&quot;&gt;5 Needs of data teams&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Having easy access to data (preferably at a single location throughout the organization)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Having the means to analyze and visualize data (i.e. good tools)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Being able to easily reproduce analyses and research (again, good tools but also processes)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sharing insights and findings in the form of reports and or presentations (ditto)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automating recurrent work (maybe built into tools, but often manually scripted)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;data-analysts-vs-data-scientists&quot;&gt;Data Analysts vs Data Scientists&lt;/h2&gt;

&lt;table style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data Analysts&lt;/th&gt;
&lt;th&gt;Data Scientists&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Work with SQL, Excel&lt;/td&gt;
&lt;td&gt;Work with scripting tools such as R, Python or SAS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Focus on reporting, using existing data&lt;/td&gt;
&lt;td&gt;Focus on training ML models for predictive or exploratory analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;        

&lt;h2 id=&quot;relational-vs-non-relational-databases&quot;&gt;Relational vs Non-relational Databases&lt;/h2&gt;

&lt;p&gt;There&amp;#39;s a &lt;strong&gt;tradeoff&lt;/strong&gt; between flexibility and consistency.&lt;/p&gt;

&lt;p&gt;Non-relational databases allow for more flexibility but there may be a higher risk of &lt;strong&gt;inconsistency&lt;/strong&gt; (because the data may not be normalized as in relational databases)&lt;/p&gt;

&lt;h2 id=&quot;row-based-vs-column-based-data-stores&quot;&gt;Row-based vs Column-based data stores&lt;/h2&gt;

&lt;p&gt;Column-based data stores are more suitable for most analytics workflows because you are very often interested in viewing &lt;strong&gt;a single attribute over many records&lt;/strong&gt; (as opposed to viewing the same record over many attributes)&lt;/p&gt;

&lt;p&gt;Row-based stores sometimes allow you do remodel your existing row-based data as columns, for example using the &lt;a href=&quot;https://www.citusdata.com/blog/2014/04/03/columnar-store-for-analytics/&quot;&gt;PostgreSQL Columnar Store Extension&lt;/a&gt; for Postgres versions starting from 9.3.&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/VrNWTuC.png&quot; alt=&quot;io-utilization-for-postgres-citusdata-columnar-store&quot;&gt;
  &lt;em&gt;Dramatically lower IO usage when using columnar data store (brown &lt;br /&gt;
  and black) vs regular Postgres data types (blue) &lt;br /&gt; Source: citusdata.com&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h2 id=&quot;excel-is-still-useful-at-many-scales&quot;&gt;Excel is still useful at many scales&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s easy to use and intuitive.&lt;/p&gt;

&lt;p&gt;Especially for &lt;strong&gt;exploratory&lt;/strong&gt; and &lt;strong&gt;ad-hoc&lt;/strong&gt; (one-off) analysis.&lt;/p&gt;

&lt;h2 id=&quot;stakeholder-communication&quot;&gt;Stakeholder communication&lt;/h2&gt;

&lt;p&gt;Try to understand the user&amp;#39;s actual problem and needs rather than just &lt;strong&gt;blindly implementing&lt;/strong&gt; what you&amp;#39;re asked to do.&lt;/p&gt;

&lt;p&gt;By talking (really listening) to your stakeholders you can help them understand the data work your team is doing you can suggest other ways of tackling problems.&lt;/p&gt;

&lt;p&gt;For example, &lt;strong&gt;developing a simpler solution that covers 80% of their needs for 20% of the cost&lt;/strong&gt; is a massive win.&lt;/p&gt;

&lt;h2 id=&quot;metrics&quot;&gt;Metrics&lt;/h2&gt;

&lt;p&gt;If you build data products, you want to &lt;strong&gt;collect metrics&lt;/strong&gt; so that you know what specific features your users/stakeholders are using, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What features are more often used, by what types of users?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What features are really not worth their screen real estate?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I.e. maybe you could hide them from the product&amp;#39;s UI so as to reduce clutter and improve usability?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/citusdata/cstore_fdw&quot;&gt;citusdata/cstore_fdw Postgres Extension Github&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provides all sorts of optimizations for modelling Postgres data as columns.&lt;/li&gt;
&lt;li&gt;Uses ORC (Optimized Row Columnar) format.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Matplotlib, Pyplot, Pylab etc: What's the difference between these and when to use each?</title>
   <link href="http://example.com/entries/matplotlib-pylab-pyplot-etc-what-s-the-different-between-these"/>
   <updated>2017-09-26T17:41:24-03:00</updated>
   <id>http://example.com/entries/matplotlib-pylab-pyplot-etc-what-s-the-different-between-these</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Matplotlib is the toolkit, PyPlot is an interactive way to use Matplotlib and PyLab is the same thing as PyPlot but with some extra shortcuts. Using PyLab is discouraged now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All example notebooks can be found &lt;a href=&quot;https://github.com/queirozfcom/python-sandbox/tree/master/python3/notebooks/matplotlib&quot;&gt;on this link&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;matplolib&quot;&gt;Matplolib&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s a Python plotting library, inspired by MATLAB, meaning that the terms used (Axis, Figure, Plots) will be similar to those used in MATLAB.&lt;/p&gt;

&lt;p&gt;It can be used both within a Python system (via the object-oriented API) but also in more convenient form in Jupyter and IPython notebooks via the Pyplot interface.&lt;/p&gt;

&lt;h2 id=&quot;pyplot&quot;&gt;Pyplot&lt;/h2&gt;

&lt;p&gt;PyPlot is a &lt;strong&gt;shell-like&lt;/strong&gt; interface to Matplotlib, to make it easier to use for people who are used to MATLAB.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Pyplot maintains &lt;strong&gt;state&lt;/strong&gt; across calls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Useful for use in Jupyter or IPython notebooks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your can import it via the &lt;code&gt;matplotlib.pyplot&lt;/code&gt; namespace.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/OHNlTIc.png&quot; alt=&quot;plotting-with-pyplot&quot;&gt;
  &lt;em&gt;Simplest possible example: &lt;code&gt;scatter&lt;/code&gt; function from pyplot namespace&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h2 id=&quot;pylab&quot;&gt;Pylab&lt;/h2&gt;

&lt;p&gt;Someone had the idea of combining both the PyPlot and NumPy namespaces into a single one (to avoid having to import two namespaces), the result is PyLab.&lt;/p&gt;

&lt;p&gt;Using Pylab is now &lt;strong&gt;discouraged&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pylab&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# you can now use both pyplot and numpy&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# functions as if they had been imported&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# from numpy namespace&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# from numpy.random namespace&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;randn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# from pyplot namespace&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/Ih7hrt1.png&quot; alt=&quot;plot-using-pylab&quot;&gt;
  &lt;em&gt;Functions like &lt;code&gt;scatter()&lt;/code&gt; from pyplot are available when you import pylab too.&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h2 id=&quot;key-plotting-concepts&quot;&gt;Key plotting concepts&lt;/h2&gt;

&lt;p&gt;These are important parts of the Matplotlib/Pyplot ecosystem and here are examples and information on what they stand for.&lt;/p&gt;

&lt;h3 id=&quot;matplotlib-figure&quot;&gt;Matplotlib: Figure&lt;/h3&gt;

&lt;p&gt;Figure is the object that keeps the whole image output.&lt;/p&gt;

&lt;p&gt;You can use it to configure things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Image size (&lt;code&gt;set_size_inches()&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Whether to use &lt;code&gt;tight_layout&lt;/code&gt; (&lt;code&gt;set_tight_layout()&lt;/code&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This adjusts the subplot padding; generally makes things look better.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;matplotlib-axes&quot;&gt;Matplotlib: Axes&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;See all methods available in the &lt;a href=&quot;https://matplotlib.org/api/axes_api.html&quot;&gt;Axes Class API&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Axes object represents the pair of axis that contain a single plot (x-axis and y-axis).&lt;/p&gt;

&lt;p&gt;The Axes object has methods to allow you to configure things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The plot frame (&lt;code&gt;set_frame_on()&lt;/code&gt; or &lt;code&gt;set_frame_off()&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;X-axis and Y-axis limits (&lt;code&gt;set_xlim()&lt;/code&gt; and &lt;code&gt;set_ylim()&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;X-axis and Y-axis Labels (&lt;code&gt;set_xlabel()&lt;/code&gt; and &lt;code&gt;set_ylabel()&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The plot title (&lt;code&gt;set_title()&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;pyplot-plt-gcf&quot;&gt;Pyplot: plt.gcf()&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;GCF stands for &lt;strong&gt;Get Current Figure&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;plt.gcf()&lt;/code&gt; allows you to get a reference to the current figure when using &lt;strong&gt;pyplot&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Example: change image sizes using &lt;code&gt;fig.set_size_inches()&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# this call creates a figure in the background&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# this allows you to retrieve the figure created&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# by the call to scatter() above&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;fig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gcf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;fig&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_size_inches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/qALPQ9s.png&quot; alt=&quot;resized-image&quot;&gt;
  &lt;em&gt;Same image as above, resized. &lt;br/&gt; We used the plt.gcf() function to get a reference to &lt;br/&gt; the current figure and then called the &lt;br/&gt; set_size_inches() method on it.&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h3 id=&quot;pyplot-plt-gca&quot;&gt;Pyplot: plt.gca()&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;GCA stands for &lt;strong&gt;Get Current Axes&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Same as with &lt;code&gt;plt.gcf()&lt;/code&gt;, you can use &lt;code&gt;plt.gca()&lt;/code&gt; to get a reference to the current axes, if you need to change the limits on the y-axis, for example.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# this call creates a figure in the background&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# this allows you to retrieve the axis&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# in the figure created &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# by the call to scatter() above&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gca&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_ylim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/vyofRRE.png&quot; alt=&quot;y-limits-changed&quot;&gt;
  &lt;em&gt;Note that the y-axis now ranges from -3 to 3. &lt;br/&gt; We got a reference to the current axis by &lt;br/&gt; calling plt.gca(). Then we called the set_lim()&lt;br/&gt; method to adjust the limits for that axis.&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h3 id=&quot;pyplot-plt-cla-vs-plt-clf&quot;&gt;Pyplot: plt.cla() VS plt.clf()&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;cla&lt;/strong&gt; stands for &amp;#39;clear current axes&amp;#39; and &lt;strong&gt;clf&lt;/strong&gt; stands for &amp;#39;clear current figure&amp;#39;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These methods are used to &lt;strong&gt;clear&lt;/strong&gt; the current figure (&lt;code&gt;plt.clf()&lt;/code&gt;) or the current axes (&lt;code&gt;plt.cla()&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;It&amp;#39;s common to call these methods just before defining a chart so that previous plots don&amp;#39;t interfere with the next ones.&lt;/p&gt;

&lt;hr&gt;

&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://matplotlib.org/api/axes_api.html&quot;&gt;Matplotlib Docs: Axes Class API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure&quot;&gt;Matplotlib Docs: Figure Class API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://matplotlib.org/api/pyplot_summary.html&quot;&gt;All functions available in the PyPlot namespace&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>5 Tips for moving your Data Science Operation to the next Level</title>
   <link href="http://example.com/entries/5-tips-for-moving-your-data-science-operation-to-the-next-level"/>
   <updated>2017-09-25T23:54:58-03:00</updated>
   <id>http://example.com/entries/5-tips-for-moving-your-data-science-operation-to-the-next-level</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Based on: &lt;a href=&quot;http://lineardigressions.com/episodes/2017/9/24/disciplined-data-science&quot;&gt;Linear Digressions Podcast: Disciplined Data Science&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here are a couple of principles to keep in mind to if you want to avoid getting stuck in low-level data analytics, in any organization, but particularly larger ones.&lt;/p&gt;

&lt;p&gt;These principles were taken from the &lt;strong&gt;Linear Digressions&lt;/strong&gt; podcast, in an episode where suggest we apply these principles so as to add more &amp;quot;method&amp;quot; or &amp;quot;discipline&amp;quot; to the practice of data science.&lt;/p&gt;

&lt;h2 id=&quot;discoverability&quot;&gt;Discoverability&lt;/h2&gt;

&lt;p&gt;You need to make your work as a data scientist easily available and findable by other teams, otherwise people may not fully benefit from what you do, or worse, someone may redo work you have already done.&lt;/p&gt;

&lt;p&gt;A couple of easy ways to make your work available are Project Wikis, APIs or dashboarding.&lt;/p&gt;

&lt;h2 id=&quot;automation&quot;&gt;Automation&lt;/h2&gt;

&lt;p&gt;Once you&amp;#39;ve solved a problem, automate it (e.g. Cron Jobs, Workflows) so that you can move on to other tasks.&lt;/p&gt;

&lt;h2 id=&quot;collaboration&quot;&gt;Collaboration&lt;/h2&gt;

&lt;p&gt;Data science is very often a team sport. Knowing how to collaborate with other team members (across roles) is very important.&lt;/p&gt;

&lt;h2 id=&quot;empowerment&quot;&gt;Empowerment&lt;/h2&gt;

&lt;p&gt;Use tools (for data science, machine learning, etc) that are widely used by the community to minimize risk and make it easier for other teams to verify your work or help you out.&lt;/p&gt;

&lt;h2 id=&quot;deployment&quot;&gt;Deployment&lt;/h2&gt;

&lt;p&gt;People have expectations on how accurate and reliable your work is.&lt;/p&gt;

&lt;p&gt;When you publish or otherwise make your work available as a &lt;strong&gt;data product&lt;/strong&gt;, be careful not to let them down so that they know they can trust you. &lt;/p&gt;

&lt;h2 id=&quot;my-2c-data-science-code-is-software-too&quot;&gt;My 2c: Data science code is software too&lt;/h2&gt;

&lt;p&gt;I.e. all known good practices from software engineering still apply (low coupling, high cohesion, testable code, comments and documentation)&lt;/p&gt;

&lt;h2 id=&quot;my-2c-focus-on-business-needs&quot;&gt;My 2c: Focus on business needs&lt;/h2&gt;

&lt;p&gt;Data science is only as good as the business problems it solves. &lt;/p&gt;

&lt;p&gt;Sometimes a simple exploratory analysis or simple model is a cost-effective solution to a simple problem. There&amp;#39;s no place for egos here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://solutions.civisanalytics.com/DisciplinedDataScience.html?utm_medium=podcast&amp;utm_source=cv-referral&amp;utm_campaign=civis-disciplineddatawhitepaper&quot;&gt;Civis Analytics Whitepaper: Build a Disciplined Data Science Team&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Highlights of the Talk with  Dr. Konstan on Recommender Systems</title>
   <link href="http://example.com/entries/highlights-of-the-talk-with-dr-konstan-on-recommender-systems"/>
   <updated>2017-09-23T23:04:59-03:00</updated>
   <id>http://example.com/entries/highlights-of-the-talk-with-dr-konstan-on-recommender-systems</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Original content: &lt;a href=&quot;https://dataskeptic.com/blog/episodes/2017/recommender-systems-live-from-farcon&quot;&gt;Recommender Systems: (live from Farcon) at Data Skeptic&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here are some topics I&amp;#39;ve considered interesting after listening to the above Podcast on Data Skeptic.&lt;/p&gt;

&lt;h2 id=&quot;serendipity&quot;&gt;Serendipity&lt;/h2&gt;

&lt;p&gt;It is the extent to which users are &amp;quot;positively suprised&amp;quot; when recommended new content.&lt;/p&gt;

&lt;p&gt;Maximizing serendipity is an actively pursued objective of Recommender Systems, particularly in recent years.&lt;/p&gt;

&lt;h2 id=&quot;serpentining&quot;&gt;Serpentining&lt;/h2&gt;

&lt;p&gt;A bit counter-intuitive - it refers to actively refraining from showing the best (most relevant) recommendations first so as to force users to keep looking at other recommendations and promote more interaction with the system.&lt;/p&gt;

&lt;h2 id=&quot;diversity&quot;&gt;Diversity&lt;/h2&gt;

&lt;p&gt;It refers to promoting a &lt;em&gt;diverse&lt;/em&gt; set of recommendations, so as to avoid recommending items that are too similar to one another.&lt;/p&gt;

&lt;p&gt;Note that diversity is especially important when your customers are &lt;strong&gt;not repeat customers&lt;/strong&gt; (i.e. they will very rarely come to your website, or even once only), because you may only have a single chance of conversion, so you want to hedge your bets using diverse content.&lt;/p&gt;

&lt;p&gt;On the other hand, focusing too much on diversity may affect recurring customers, because they may want to be able to &lt;em&gt;learn&lt;/em&gt; how you system behaves. I.e. they expect your system to behave consistently, and may not like too much variation in the recommendations.&lt;/p&gt;

&lt;h2 id=&quot;focus-on-business-model&quot;&gt;Focus on business model&lt;/h2&gt;

&lt;p&gt;Knowing about the business model your organization wants to pursue is critical to thinking and planning good Recommender Systems.&lt;/p&gt;

&lt;p&gt;In other words, you need to consider the precise &lt;strong&gt;business objective&lt;/strong&gt; you want to achieve when designing RSs. This will guide you towards choosing what &lt;strong&gt;metrics&lt;/strong&gt; you want to keep an eye on: For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Does your company want to maximize short-term item sales or long-term user retention?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Does your company want to maximize &lt;em&gt;any&lt;/em&gt; sale, even if it&amp;#39;s not the item that was recommended, or just maximize conversion for shown items?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;temporal-effects&quot;&gt;Temporal effects&lt;/h2&gt;

&lt;p&gt;People&amp;#39;s tastes change over time!&lt;/p&gt;

&lt;p&gt;You need to take this into account (introduce adaptive behaviour into your models), otherwise you risk failing to capitalize on new trends and other changes in user behaviour.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://dataskeptic.com/blog/episodes/2017/recommender-systems-live-from-farcon&quot;&gt;Data Skeptic Podcast: September 15, 2017&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Data Provenance: Quick Summary + Reasons Why</title>
   <link href="http://example.com/entries/data-provenance-quick-summary-reasons-why"/>
   <updated>2017-09-07T00:16:15-03:00</updated>
   <id>http://example.com/entries/data-provenance-quick-summary-reasons-why</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Original content: &lt;a href=&quot;http://lineardigressions.com/episodes/2017/9/3/data-lineage&quot;&gt;Linear Digressions Podcast: Data Lineage&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Data Provenance&lt;/strong&gt; (also called Data Lineage) is to datasets as version control systems (e.g. Git, SVN) are to source code.&lt;/p&gt;

&lt;p&gt;The basic idea is that you keep track of modifications you make to a dataset as you work with it.&lt;/p&gt;

&lt;p&gt;Some common ways in which datasets are modified in this way are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Missing Data Imputation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Cleaning, removing noisy or corrupted records&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dimensionality Reduction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;etc&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;two-approaches&quot;&gt;Two approaches&lt;/h2&gt;

&lt;p&gt;The two basic approaches to keeping track of data provenance are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Track the states&lt;/strong&gt;: You basically take snapshots of your dataset after each modification.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is more robust but takes more space&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Track the modifications&lt;/strong&gt;: You keep track of the &lt;em&gt;operations&lt;/em&gt; you performed in each step of the way.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A bit less robust (modifications may not be reversible) but takes much less space.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;4-reasons-why-you-will-want-to-version-control-your-data&quot;&gt;4 Reasons why you will want to version control your data&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It helps you &lt;strong&gt;Keep data quality&lt;/strong&gt;, because you can easily track down possible bugs and missing data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is very useful for &lt;strong&gt;Auditing Puposes&lt;/strong&gt;, in cases you need to prove why you (or your model) made some decision.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It&amp;#39;s probably unavoidable for &lt;strong&gt;Experiment Reproducibility&lt;/strong&gt;. You can only reproduce a result having the same data it was obtained from.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It&amp;#39;s also useful from a purely &lt;strong&gt;Informational standpoint&lt;/strong&gt;. Having this kind of evolution-based view of your data enables you to look at your process from outside, think about how it can be made better, etc.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This may also be needed if you are part of a team where each member role only works at a specific part of the pipeline.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;Data Newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.pachyderm.io/index.html&quot;&gt;Pachyderm.io&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It looks like some sort of language-agnostic toolkit that enables you to define data pipelines and workflows and run your code in a distributed way&lt;/li&gt;
&lt;li&gt;Both open-source and enterprise editions&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://drivendata.github.io/cookiecutter-data-science/&quot;&gt;Cookiecutter data science&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It&amp;#39;s a command-line data science project generator&lt;/li&gt;
&lt;li&gt;It helps you create a standard directory structure for your data science project.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Lessons from the Netflix Prize: Changing Requirements and Cost-Effectiveness</title>
   <link href="http://example.com/entries/the-netflix-prize-changing-requirements-and-cost-effectiveness"/>
   <updated>2017-09-03T22:15:03-03:00</updated>
   <id>http://example.com/entries/the-netflix-prize-changing-requirements-and-cost-effectiveness</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Original Article on Techdirt: &lt;a href=&quot;https://www.techdirt.com/articles/20120409/03412518422/why-netflix-never-implemented-algorithm-that-won-netflix-1-million-challenge.shtml&quot;&gt;Why Netflix Never Implemented the Algorithm that won the Netflix $1 Million Challenge&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;the-winning-solution-1st-place-was-an-ensemble-of-more-than-100-separate-models&quot;&gt;The Winning Solution (1st Place) was an Ensemble of more than 100 separate models&lt;/h2&gt;

&lt;p&gt;Out of all 107 component models, the two best individual algorithms were based on &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Matrix Factorization and &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RBM (Restricted Bolztmann Machines)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These two were the only parts actually used by Netflix.&lt;/p&gt;

&lt;h2 id=&quot;too-complex-for-the-improvements-on-the-other-solutions&quot;&gt;Too Complex for the Improvements on the other Solutions&lt;/h2&gt;

&lt;p&gt;The Netflix team made a simplified model using just the two best performing individual models (as above) and used that in actual production systems.&lt;/p&gt;

&lt;p&gt;The full model had slightly better performance than the simplified model, but this came at a much higher engineering effort (the full model was much more complicated to build).&lt;/p&gt;

&lt;h2 id=&quot;requirements-had-changed-by-the-time-netflix-actually-implemented-it&quot;&gt;Requirements had changed by the time Netflix actually implemented it&lt;/h2&gt;

&lt;p&gt;The challenge was made with movie rentals in mind but, by the time it was going to be used, streaming had become a much more important part of the Netflix business model.&lt;/p&gt;

&lt;p&gt;Also, Netflix had recently gone international and become available on many more devices, thus affecting the way viewers consumed the products.&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/TEL0koz.gif&quot; alt=&quot;dilbert-requirements&quot;&gt;
  &lt;em&gt;Apparently, data science is software too.&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;h2 id=&quot;recommending-movies-for-rental-vs-recommending-streaming-content&quot;&gt;Recommending movies for rental vs recommending streaming content&lt;/h2&gt;

&lt;p&gt;Recommending streaming services is fundamentally different from recommending movies for rental.&lt;/p&gt;

&lt;p&gt;When you rent something, you want to be more certain that it&amp;#39;s good, because of the time/money you&amp;#39;ll put into it, but 
When viewing streaming content, you can afford to &lt;em&gt;experiment&lt;/em&gt; a little bit, but you are more likely to give up on something if you don&amp;#39;t immediately like it.&lt;/p&gt;

&lt;p&gt;Also, there&amp;#39;s much more data available (implicit feedback e.g. half-watched movies, movies watched multiple times) in a streaming service context and this information can be leveraged to improve recommendations.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;data newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://medium.com/netflix-techblog/netflix-recommendations-beyond-the-5-stars-part-1-55838468f429&quot;&gt;Netflix Blog: Netflix Recommendations: Beyond the 5 Stars (Part 1)&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numerous insights into the (then) way Netflix recommended stuff: movie rows, recommendation diversity, recommendation awareness&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.netflixprize.com/&quot;&gt;Neftlix Prize Webpage&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Winning Solutions Overview: Kaggle Instacart Competition</title>
   <link href="http://example.com/entries/winning-solutions-overview-kaggle-instacart-competition"/>
   <updated>2017-09-03T21:54:26-03:00</updated>
   <id>http://example.com/entries/winning-solutions-overview-kaggle-instacart-competition</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Data Newsletter&lt;/strong&gt; This short post is part of the &lt;strong&gt;data newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/overview&quot;&gt;Instacart &amp;quot;Market Basket Analysis&amp;quot; competition&lt;/a&gt; was about predicting which products in the next order would be a product that user had already ordered before.&lt;/p&gt;

&lt;h2 id=&quot;1st-place-f1-0-4091&quot;&gt;1st Place (F1 0.4091)&lt;/h2&gt;

&lt;p&gt;User didn&amp;#39;t publish his strategy.&lt;/p&gt;

&lt;h2 id=&quot;2nd-place-f1-0-4082-link&quot;&gt;2nd Place (F1: 0.4082) &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/discussion/38143&quot;&gt;(LINK)&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Approach: Manual Feature Engineering + XGBoost (Python)&lt;/p&gt;

&lt;p&gt;Note: Optimizes F1-score directly (see references)&lt;/p&gt;

&lt;h2 id=&quot;3rd-place-f1-0-4081-link&quot;&gt;3rd Place (F1: 0.4081) &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/discussion/38097&quot;&gt;(LINK)&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Approach: Feature Learning with Neural Networks, then classification using Tensorflow and LightGBM(Python)&lt;/p&gt;

&lt;h2 id=&quot;4th-place-f1-0-4074-link&quot;&gt;4th Place (F1: 0.4074) &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/discussion/38102&quot;&gt;(LINK)&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Approach: Manual Feature Engineering + Catboost&lt;/p&gt;

&lt;p&gt;Note: Optimizes F1-score directly (see references)&lt;/p&gt;

&lt;h2 id=&quot;5th-place-f1-0-4073&quot;&gt;5th Place (F1: 0.4073)&lt;/h2&gt;

&lt;p&gt;User didn&amp;#39;t publish his strategy.&lt;/p&gt;

&lt;h2 id=&quot;6th-place-f1-0-4072-link&quot;&gt;6th Place (F1: 0.4072) &lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/discussion/38112&quot;&gt;(LINK)&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Approach: Manual Feature Engineering + CatBoost&lt;/p&gt;

&lt;p&gt;Note: Optimizes F1-score directly (see references)&lt;/p&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/catboost/catboost&quot;&gt;CatBoost&lt;/a&gt; is a gradient boosting library with easier handling for categorical features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://queirozf.com/entries/evaluation-metrics-for-classification-quick-examples-references&quot;&gt;Queirozf.com: Evaluation Metrics for Classification Problems: Quick Examples + References&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.comp.nus.edu.sg/%7Eleews/publications/fscore.pdf&quot;&gt;Ye et al., 2012: Optimizing F-Measures: A Tale of Two Approaches&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here&amp;#39;s a simple implementation in Python: &lt;a href=&quot;https://www.kaggle.com/mmueller/f1-score-expectation-maximization-in-o-n&quot;&gt;F1-Expectation-Maximization&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://papers.nips.cc/paper/4389-an-exact-algorithm-for-f-measure-maximization&quot;&gt;Dembczynksi et al., 2011: An Exact Algorithm for F-Measure Maximization&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.kaggle.com/c/instacart-market-basket-analysis/discussion/38130&quot;&gt;Solution summary instacart&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More solutions and overviews here. Thanks to Kaggle user Lannister.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>A Quick Summary of Ensemble Learning Strategies</title>
   <link href="http://example.com/entries/a-quick-summary-of-ensemble-learning-strategies"/>
   <updated>2017-09-01T07:52:09-03:00</updated>
   <id>http://example.com/entries/a-quick-summary-of-ensemble-learning-strategies</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;Ensemble learning&lt;/strong&gt; refers to mixing the outputs of several underlying classifiers in various ways, in order to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Get more accurate predictions that each model individually.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help in generalization, thus reducing the risk of overfitting.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Most Kaggle competitions are won by ensemble methods (as of 2018).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The main &lt;strong&gt;types of ensemble techniques&lt;/strong&gt; are:&lt;/p&gt;

&lt;h2 id=&quot;simple-voting&quot;&gt;Simple Voting&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Train each underlying model on the whole training data&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The output of the ensemble model is the output of the majority of underlying methods.&lt;/li&gt;
&lt;li&gt;All underlying models have the same voting power.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The equivalent technique for regression is &lt;strong&gt;Model Averaging&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;weighted-voting&quot;&gt;Weighted Voting&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Train each underlying model on the whole training data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The output of the ensemble model is the output of the majority of underlying methods (as above) &lt;/li&gt;
&lt;li&gt;But some models have more voting power than others.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;bagging&quot;&gt;Bagging&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Split the training data into random subsets (sampling with replacement)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The output of the ensemble model is the average of the underlying methods.&lt;/li&gt;
&lt;li&gt;All underlying models have the same voting power.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Example: Random Forest is Bagging applied to Decision Trees. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The objective is to increase generalization power.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;stacking&quot;&gt;Stacking&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Train each underlying model on the whole training data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Train another model (e.g. Logistic Regression) to learn how to best combine the outputs of each underlying model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The objective is to increase model accuracy and generalization power.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;boosting&quot;&gt;Boosting&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Train a model on the whole training data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then train a model on the errors (residuals) of the previous model.&lt;/li&gt;
&lt;li&gt;Repeat until convergence.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The objective is to increase the accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Examples: AdaBoost and XGBoost are variants of boosting.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;data newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.toptal.com/machine-learning/ensemble-methods-machine-learning&quot;&gt;Toptal: Ensemble Methods in Machine Learning&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.learnbymarketing.com/950/winning-a-kaggle-competition-analysis/&quot;&gt;Learn by marketing: Kaggle Competition Analysis&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensembles and XGBoost (a specific type of ensemble) win by a large margin.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://mlwave.com/kaggle-ensembling-guide/&quot;&gt;MLWave: Kaggle Ensembling Guide&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large document, with tons of examples and Kaggle competitions to try the methods in.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://stats.stackexchange.com/a/186982/95456&quot;&gt;Cross Validated Answer to: Bagging Boosting and Stacking in Machine Learning&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good overview of pros/cons of bagging and boosting.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Evaluation Metrics for Classification Problems: Quick Examples + References</title>
   <link href="http://example.com/entries/evaluation-metrics-for-classification-quick-examples-references"/>
   <updated>2017-08-31T19:58:01-03:00</updated>
   <id>http://example.com/entries/evaluation-metrics-for-classification-quick-examples-references</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;True Positives (TP)&lt;/strong&gt;: should be TRUE, you predicted TRUE&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;False Positives (FP)&lt;/strong&gt;: should be FALSE, you predicted TRUE &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;True Negative (TN)&lt;/strong&gt;: should be FALSE, you predicted FALSE&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;False Negatives (FN)&lt;/strong&gt;: should be TRUE, you predicted FALSE &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;All machine learning toolkits provide these model evaluation metrics.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;accuracy&quot;&gt;Accuracy&lt;/h2&gt;

&lt;p&gt;&amp;quot;What percentage of my predictions are correct?&amp;quot;&lt;/p&gt;

&lt;p&gt;$$
\text{Accuracy} = \frac{true \ positives + true \ negatives}{true \ positives + false \ positives + true \ negatives + false \ negatives}
$$&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Good for single label, binary classifcation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not good for imbalanced datasets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If, in the dataset, 99% of samples are TRUE and you blindly predict TRUE for everything, you&amp;#39;ll have 0.99 accuracy, but you haven&amp;#39;t actually learned anything.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;precision&quot;&gt;Precision&lt;/h2&gt;

&lt;p&gt;&amp;quot;Of the points that I predicted TRUE, how many are actually TRUE?&amp;quot;&lt;/p&gt;

&lt;p&gt;$$
\text{Precision} = \frac{true \ positives}{true \ positives + false \ positives}
$$&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Good for multi-label / multi-class classification and information retrieval&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good for unbalanced datasets&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;recall&quot;&gt;Recall&lt;/h2&gt;

&lt;p&gt;&amp;quot;Of all the points that are actually TRUE, how many did I correctly predict?&amp;quot;&lt;/p&gt;

&lt;p&gt;$$
\text{Recall} = \frac{true \ positives}{true \ positives + false \ negatives}
$$&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Good for multi-label / multi-class classification and information retrieval&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good for unbalanced datasets&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;f1&quot;&gt;F1&lt;/h2&gt;

&lt;p&gt;&amp;quot;Can you give me a single metric that balances precision and recall?&amp;quot;&lt;/p&gt;

&lt;p&gt;$$
F_1 = 2 \cdot \frac{Precision \cdot Recall}{Precision + Recall}
$$&lt;/p&gt;

&lt;p&gt;Or, in terms of primitive metrics:&lt;/p&gt;

&lt;p&gt;$$
F_1 = \frac{2 \cdot true \ positives}{2 \cdot true \ positives + false \ negatives + false \ positives} 
$$&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Gives equal weight to precision and recall&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good for unbalanced datasets&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;auc-area-under-roc-curve&quot;&gt;AUC (Area under ROC Curve)&lt;/h2&gt;

&lt;p&gt;&amp;quot;Is my model better than just random guessing?&amp;quot;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The ROC curve is obtained plotting your model&amp;#39;s true-positive and false-positive rates at different points.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/wdBBEzN.jpg&quot; alt=&quot;area under roc curve&quot;&gt;
  &lt;em&gt;If your model scores less than 0.5 AUC, it&amp;#39;s no better than just random guessing. &lt;br /&gt;&lt;br /&gt; Source: http://gim.unmc.edu/dxtests/roc3.htm&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Rank-based metric&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good for cases when you need to estimate how well your model is at &lt;strong&gt;discriminating&lt;/strong&gt; TRUE from FALSE values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In other words, for every pair of instances A and B, when your model says A is more likely than B, how often is A is actually TRUE and B FALSE? &lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;gini-coefficient&quot;&gt;Gini Coefficient&lt;/h2&gt;

&lt;p&gt;The Gini coefficient is comparable to the AUC score inasmuch as it also is a rank-based metric that can be used to measure how well your model is at discriminating TRUE from FALSE values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Rank-based metric&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It ranges from 0 (chance results) to 1.0, which corresponds to perfect discrimination.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;div class=&quot;img-div&quot; markdown=&quot;1&quot;&gt;
  &lt;img src=&quot;//queirozf.com/images/contents/6vM80gn.png&quot; alt=&quot;gini-and-auc&quot;&gt;
  &lt;em&gt;A comparison between AUC Score and Gini Index on the same scoring results. &lt;br /&gt; Note that the Gini index corresponds to the area between the main diagonal and the model curve, while &lt;br /&gt; the AUC corresponds to the full area under the ROC curve. &lt;br /&gt; Adapted from https://bit.ly/2Jb6LtQ&lt;/em&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This short post is part of the &lt;strong&gt;data newsletter&lt;/strong&gt;. Click &lt;a href=&quot;http://queirozf.com/newsletters/data&quot;&gt;here&lt;/a&gt; to sign up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr&gt;

&lt;h4 id=&quot;references&quot;&gt;References:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://pages.cs.wisc.edu/%7Edpage/cs760/evaluating.pdf&quot;&gt;UWisconsin CS760: Evaluating Machine Learning Models&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Confusion_matrix&quot;&gt;Wikipedia: Confusion matrix&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Receiver_operating_characteristic&quot;&gt;Wikipedia: Receive Operating Characteristic&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://gim.unmc.edu/dxtests/roc3.htm&quot;&gt;UNebraska: The Area Under an ROC Curve&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://habrahabr.info/development/machine-learning/241-coefficient-gini-from-economy-to-machine-learning.html&quot;&gt;Habrhabr.info: Coefficient Gini (Sic) From Economy to Machine Learning&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
</feed>