<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>IanHuston.net</title>
	<atom:link href="https://www.ianhuston.net/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ianhuston.net</link>
	<description></description>
	<lastBuildDate>Sun, 05 Apr 2020 19:09:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">51466317</site>	<item>
		<title>Advent of Code 2017 in Kotlin</title>
		<link>https://www.ianhuston.net/2018/01/advent-of-code-2017-in-kotlin/</link>
					<comments>https://www.ianhuston.net/2018/01/advent-of-code-2017-in-kotlin/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Mon, 15 Jan 2018 11:08:54 +0000</pubDate>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Advent Of Code]]></category>
		<category><![CDATA[Kotlin]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[TDD]]></category>
		<guid isPermaLink="false">https://www.ianhuston.net/?p=792</guid>

					<description><![CDATA[I talk about Python a lot here but at work we also write quite a bit of Java (with Spring of course). Since it hit 1.0 in 2016, I&#8217;ve been hearing more and more about Kotlin as a viable alternative to standard Java on the JVM. At Pivotal we&#8217;re seeing clients start to use Kotlin <a class="read-more" href="https://www.ianhuston.net/2018/01/advent-of-code-2017-in-kotlin/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>I talk <a href="https://www.ianhuston.net/2014/02/pydata-london-2014/">about</a> <a href="https://www.ianhuston.net/2014/11/python-on-cloud-foundry/">Python</a> <a href="https://www.ianhuston.net/2016/11/snakes-in-a-buildpack/">a lot</a> <a href="https://www.ianhuston.net/2017/10/bringing-django-to-cloud-foundry/">here</a> but at work we also write quite a bit of Java (with <a href="http://spring.io">Spring</a> of course). Since it hit 1.0 in 2016, I&#8217;ve been hearing more and more about <a href="http://kotlinlang.org">Kotlin</a> as a viable alternative to standard Java on the JVM.</p>
<p><a href="http://kotlinlang.org"><img src="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Kotlin_logo_image_picture-300x76.png" alt="Kotlin" width="300" height="76" class="alignleft size-medium wp-image-793" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Kotlin_logo_image_picture-300x76.png 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Kotlin_logo_image_picture-768x195.png 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Kotlin_logo_image_picture-1024x259.png 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Kotlin_logo_image_picture.png 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>At Pivotal we&#8217;re seeing clients start to use Kotlin because of its brevity compared to Java, the ease of use of existing Java based libraries, the adoption by Google for Android, and the (relatively new) ability to also target Javascript.</p>
<p>To find out what all the fuss is about, I decided to try out Kotlin for last month&#8217;s <a href="http://adventofcode.com">Advent of Code</a> set of programming puzzles.<br />
<a href="http://adventofcode.com"><img src="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-11-at-21.16.45.png" alt="Advent of Code 2017" width="342" height="134" class="alignright size-full wp-image-794" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-11-at-21.16.45.png 342w, https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-11-at-21.16.45-300x118.png 300w" sizes="(max-width: 342px) 100vw, 342px" /></a></p>
<p>True to its reputation, it was easy to get a project started in Kotlin (using IntelliJ) and familiar tools like JUnit for testing are available without any trouble.</p>
<p>The puzzles in Advent of Code are of a particular type, mainly computational tasks with some algorithmic tricks often necessary for the more difficult second half of each challenge. So this was really a test of how well I could use Kotlin for these kinds of problems, rather than, say, doing a lot of data cleaning or creating an Android app. The well written problem descriptions lend themselves very well to a TDD approach as they almost always include examples that capture the complexity of the problem.</p>
<p>You can take a look at my solutions for the first <a href="https://github.com/ihuston/aoc_2017">21 days of problems</a> on Github. In the run up to Christmas, family preparations and celebrations took precedence over coding puzzles, but I&#8217;ll update the repo if I get time to complete the last few days.</p>
<p>It&#8217;s early days for my use of Kotlin, but so far I&#8217;ve found the language to be a nice mix of my favourite parts of Python (simplicity and flexibility) and Java (type safety and language specific tooling). Recently there has even been a movement to build a community of <a href="https://github.com/thomasnield/kotlin-data-science-resources">data scientists using Kotlin</a>, and <a href="http://tomstechnicalblog.blogspot.ie/">Thomas Nield&#8217;s</a> <a href="https://www.youtube.com/watch?v=J8GYPG6pt5w">videos</a> are a good way to get started in this area.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2018/01/advent-of-code-2017-in-kotlin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">792</post-id>	</item>
		<item>
		<title>Flexible conda package dependencies on Cloud Foundry</title>
		<link>https://www.ianhuston.net/2018/01/flexible-conda-package-dependencies-on-cloud-foundry/</link>
					<comments>https://www.ianhuston.net/2018/01/flexible-conda-package-dependencies-on-cloud-foundry/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Fri, 05 Jan 2018 17:31:09 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[buildpack]]></category>
		<category><![CDATA[Cloud Foundry]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://www.ianhuston.net/?p=776</guid>

					<description><![CDATA[The official Python Cloud Foundry buildpack has support for conda environments using the environment.yml file. This provides a lot of flexibility for Python (and other) dependencies and helps you to use packages from other public and private sources including your own locally built ones. Using other conda channels One thing this allows you to do <a class="read-more" href="https://www.ianhuston.net/2018/01/flexible-conda-package-dependencies-on-cloud-foundry/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>The official <a href="https://github.com/cloudfoundry/python-buildpack/">Python Cloud Foundry buildpack</a> has support for conda environments using the <code>environment.yml</code> file. This provides a lot of flexibility for Python (and other) dependencies and helps you to use packages from other public and private sources including your own locally built ones.</p>
<h3>Using other conda channels</h3>
<p><a href="http://conda-forge.org"><img src="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-05-at-16.52.13.png" alt="Conda-forge" width="682" height="267" class="alignright size-full wp-image-781" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-05-at-16.52.13.png 682w, https://www.ianhuston.net/blog2/wp-content/uploads/2018/01/Screen-Shot-2018-01-05-at-16.52.13-300x117.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></a></p>
<p>One thing this allows you to do is reference other channels such as <a href="http://conda-forge.org">conda-forge</a>, and get packages from there instead of the standard Anaconda provided default channel.</p>
<p>We can specify <code>conda-forge</code> as a channel in our <code>environment.yml</code> file and then install a package like <a href="https://github.com/adamlamers/prettytable">prettytable</a>. This enables a lot of flexibility to access the latest and greatest conda packages from anywhere.</p>
<pre class="brush: yaml; title: ; notranslate">
name: myenv
channels:
  - conda-forge
dependencies:
  - python=3.6
  - flask
  - gunicorn
  - prettytable
</pre>
<p>&nbsp;</p>
<h3>Vendoring conda packages with your app</h3>
<p>However, what happens if you need a particular package but you can&#8217;t access the public internet from your CF installation? In the Python buildpack, the pip-based approach <a href="https://docs.cloudfoundry.org/buildpacks/python/index.html#vendoring">supports the concept of &#8220;vendoring&#8221;</a>, providing dependency packages alongside your application code when uploading to CF.</p>
<p>You can do this with conda packages as well, by pointing to a local conda channel created in your app directory.</p>
<p>If you are packaging your own library, there are lots of tutorials on how to <a href="https://conda.io/docs/user-guide/tutorials/build-pkgs.html">build a conda package for it</a>, depending on the complexity. If you need an existing third-party library you can use any of the existing conda packages from <a href="http://anaconda.org">anaconda.org</a> or <a href="http://conda-forge.org">conda-forge</a>.</p>
<p>The next step is to <a href="https://conda.io/docs/user-guide/tasks/create-custom-channels.html">create a local conda channel</a> in your app directory. This is essentially a series of directories for each architecture you need (<code>osx_64</code>, <code>linux</code>, <code>win</code>, and <code>noarch</code> for pure Python packages) which you tell conda about by creating a channel index for each architecture directory:</p>
<pre class="brush: plain; title: ; notranslate">
conda index ./vendor/noarch
</pre>
<p>Once you have this channel in place in your app, you need to tell the CF buildpack about it by providing a local file path to the channel.</p>
<p>During the staging phase of CF app deployment, the buildpack installs your app and all its dependencies in a temporary container and the absolute path is <code>/tmp/app</code>. So we can provide conda with a reference to our local channel, knowing it will be located at <code>/tmp/app/vendor</code>.</p>
<pre class="brush: yaml; title: ; notranslate">
name: myenv
channels:
  - /tmp/app/vendor
dependencies:
  - python=3.6
  - flask
  - gunicorn
  - mypkg

</pre>
<p>When we <code>cf push</code> our local conda package file will be uploaded along with our app, and the Python buildpack will install it along with any other dependencies required. In this way you can mix local and public packages easily.</p>
<p>If you want to see this in action, I&#8217;ve created a <a href="https://github.com/ihuston/simple_conda_pkg">very simple example package</a>, and a <a href="https://github.com/ihuston/conda-channels-on-cf">corresponding CF app</a> that installs this package from a local channel, as well as getting prettytables from conda-forge. For more details on using Python on Cloud Foundry, <a href="https://www.ianhuston.net/2014/11/python-on-cloud-foundry/">take a look at my tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2018/01/flexible-conda-package-dependencies-on-cloud-foundry/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">776</post-id>	</item>
		<item>
		<title>Bringing a Python Django app to Cloud Foundry in 2017</title>
		<link>https://www.ianhuston.net/2017/10/bringing-django-to-cloud-foundry/</link>
					<comments>https://www.ianhuston.net/2017/10/bringing-django-to-cloud-foundry/#comments</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Sun, 08 Oct 2017 19:29:31 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Cloud Foundry]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[TDD]]></category>
		<guid isPermaLink="false">https://www.ianhuston.net/?p=747</guid>

					<description><![CDATA[In this post I want to answer the question: What do you have to do to run a Django web app on Cloud Foundry in 2017? In the past, a few other people have described their approaches, but given that Cloud Foundry is continuously changing and improving, I thought it would be good to revisit <a class="read-more" href="https://www.ianhuston.net/2017/10/bringing-django-to-cloud-foundry/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>In this post I want to answer the question:<br />
<strong>What do you have to do to run a Django web app on Cloud Foundry in 2017?</strong></p>
<p>In the past, a few <a href="https://manigopalakrishnan.com/2016/07/01/django-buildpack-for-cloud-foundry/">other</a> <a href="https://banck.net/2014/12/deploying-a-django-application-to-cloud-foundry/">people</a> have described their approaches, but given that Cloud Foundry is continuously changing and improving, I thought it would be good to revisit the topic and learn about Python &amp; Django support in 2017.</p>
<h2>Python on Cloud Foundry</h2>
<p><a href="http://cloudfoundry.org">Cloud Foundry</a> is a polyglot application deployment system. At <a href="http://pivotal.io">Pivotal</a> [disclosure: where I work, but not on the Cloud Foundry team], we put a lot of emphasis on how great a home Cloud Foundry is for Java Spring applications, and we&#8217;ve always been fond of Ruby on Rails.</p>
<p>That doesn&#8217;t mean other languages are hard to run on CF though. Following the example of Heroku, CF uses <a href="https://docs.cloudfoundry.org/buildpacks/using-buildpacks.html">&#8216;buildpacks&#8217;</a> to provide <a href="https://docs.cloudfoundry.org/buildpacks">official support for many languages</a>, and community support <a href="https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks#community-created">for many more</a>.</p>
<p>Python is an officially supported language for CF, and the official buildpack is maintained and updated by the buildpacks team. This gives me confidence that I can rely on the Python buildpack to have up-to-date interpreters and saves me the hassle of finding or creating a custom buildpack.</p>
<h2>Pre-requisites</h2>
<p>I&#8217;ve been going through the updated 2nd edition of the &#8216;Obey the Testing Goat book&#8217; otherwise known as <a href="https://www.obeythetestinggoat.com"><em>Test Driven Development With Python</em> by Harry J.W. Percival</a>.<br />
<a href="https://www.obeythetestinggoat.com/"><img src="https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/obey_the_testing_goat-229x300.jpg" alt="Test Driven Development with Python" width="229" height="300" class="alignright size-medium wp-image-755" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/obey_the_testing_goat-229x300.jpg 229w, https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/obey_the_testing_goat.jpg 500w" sizes="(max-width: 229px) 100vw, 229px" /></a></p>
<p>In the book you build up a Django application from scratch using a TDD approach. I&#8217;m going to deploy this &#8216;Superlists&#8217; to-do list application on to Cloud Foundry.</p>
<p>If you want to follow along you should have completed all the exercises up to and including Chapter 10, which includes adding <code>gunicorn</code> to <code>requirements.txt</code>. You can take a look at <a href="https://github.com/ihuston/tdd_with_python_book_examples/tree/fffede2aba5c5ff51e711908ce98327fd086ec76">my version of the app</a> at this point.</p>
<p><em>If you want to skip ahead and see all the changes we&#8217;ll make to the app, have a look <a href="https://github.com/ihuston/tdd_with_python_book_examples/commit/5bee0b579f0a11ca650226fb67d8ae7d15d7e381">at this commit</a>.</em></p>
<p>First we&#8217;ll start as always by checking that our functional tests run successfully on our local machine.</p>
<pre class="brush: bash; title: ; notranslate">
$ python manage.py test functional_tests
</pre>
<p>All green, so we&#8217;re good to go!</p>
<h2>Getting ready for Cloud Foundry</h2>
<p>We are going to push our application to Cloud Foundry which will create a domain name for us. Let&#8217;s use the <code>STAGING_SERVER</code> variable to test this. I am aiming for the domain <code>ih-superlists.cfapps.io</code>, yours will vary based on your Cloud Foundry provider.</p>
<pre class="brush: bash; title: ; notranslate">
$ STAGING_SERVER=ih-superlists.cfapps.io python manage.py test functional_tests
</pre>
<p>As expected the tests fail completely.</p>
<p>Let&#8217;s get started on deploying to Cloud Foundry. We need to provide a &#8216;manifest&#8217; file which tells Cloud Foundry how to deploy our application.</p>
<p><em>manifest.yml</em></p>
<pre class="brush: plain; title: ; notranslate">
---
applications:
- name: ih-superlists
  memory: 512M
  instances: 1
  buildpack: python_buildpack
  command: gunicorn superlists.wsgi:application
</pre>
<p>Then you can try to deploy using <code>$ cf push</code> and look at the logs with <code>$ cf logs ih-superlists</code>.</p>
<p>If your CF setup is like mine you&#8217;ll see</p>
<pre class="brush: plain; title: ; notranslate">
... [APP/PROC/WEB/0] ERR   File &quot;/home/vcap/app/lists/views.py&quot;, line 16
    [APP/PROC/WEB/0] ERR     return redirect(f&#039;/lists/{list_.id}/&#039;)
    [APP/PROC/WEB/0] ERR                                         ^
    [APP/PROC/WEB/0] ERR SyntaxError: invalid syntax
</pre>
<p>Oops! We forgot that CF expects to run Python 2 applications by default (<a href="https://wiki.python.org/moin/Python2orPython3">boo!</a>). Let&#8217;s tell it our application doesn&#8217;t use <a href="">legacy Python</a>.</p>
<p><em>runtime.txt</em></p>
<pre class="brush: plain; title: ; notranslate">
python-3.6.2
</pre>
<p>And then <code>$ cf push</code> again.</p>
<p>We also need to add our domain to ALLOWED_HOSTS in our settings file.</p>
<p><em>superlists/settings.py</em></p>
<pre class="brush: python; title: ; notranslate">
ALLOWED_HOSTS = [&#039;ih-superlists.cfapps.io&#039;]
</pre>
<p>Now we can see our (non-CSS&#8217;d) site running at <code>ih-superlists.cfapps.io</code>! Let&#8217;s run our functional tests</p>
<pre class="brush: bash; title: ; notranslate">
$ STAGING_SERVER=ih-superlists.cfapps.io python manage.py test functional_tests
</pre>
<p>All three tests still fail!</p>
<h2>Serving static files</h2>
<p>One of the problems is that our static files are  not being served properly. In our logs we can see the requests for our static files:</p>
<pre class="brush: plain; title: ; notranslate">
... [APP/PROC/WEB/0] ERR Not Found: /static/base.css
    [APP/PROC/WEB/0] ERR Not Found: /favicon.ico
    [APP/PROC/WEB/0] ERR Not Found: /static/bootstrap/css/bootstrap.min.css
    [APP/PROC/WEB/0] ERR Not Found: /static/base.css
</pre>
<p>The CF Python buildpack actually runs collectstatic as part of its process. Where are these files going? We can look inside the container by connecting with <code>$ cf ssh ih-superlists</code>.</p>
<p>The files are being collected during the staging process into /tmp/app/static, but this directory is not available in the eventual container that runs the application. Hence the lack of static files for our app!</p>
<p>Let&#8217;s collect our static files just before we start the gunicorn server instead.</p>
<p><em>manifest.yml</em></p>
<pre class="brush: plain; title: ; notranslate">
  command: python manage.py collectstatic --noinput &amp;&amp; gunicorn superlists.wsgi:application
</pre>
<p>From the logs we can see that the static files are now in `/home/vcap/static&#8217;.</p>
<p>Side note: The VCAP acronym stands for VMware Cloud Application Platform, which was <a href="https://www.quora.com/Is-vcap-an-alias-of-cloudfoundry-or-its-development-code-name/answer/Derek-Collison?srid=dqiB">the original name</a> of Cloud Foundry when it started at VMware.</p>
<p>We can run our functional tests again, or look at the live site and see that this hasn&#8217;t fixed our static files problem. We now have the static files, but they are not being served by gunicorn.</p>
<p>One way to fix this is to gather these files and serve them with another Cloud Foundry app which uses the static buildpack. We only expect a small amount of traffic for our application so in this case we can try to serve these files from the same server, using the Whitenoise Python library.</p>
<p>Add Whitenoise to your requirements.txt and then update the settings to include it in the Django middleware that is used.</p>
<pre class="brush: bash; title: ; notranslate">
$ pip install whitenoise
$ pip freeze | grep whitenoise &gt;&gt; requirements.txt
</pre>
<p><em>superlists/settings.py</em></p>
<pre class="brush: python; title: ; notranslate">
MIDDLEWARE_CLASSES = [
  &#039;django.middleware.security.SecurityMiddleware&#039;,
  &#039;whitenoise.middleware.WhiteNoiseMiddleware&#039;,
  # ...
]
</pre>
<p>We can now see our site is served with CSS, but the functional tests still fail.</p>
<h2>Adding a managed database</h2>
<p>We can also see the problem in the logs.</p>
<pre class="brush: plain; title: ; notranslate">
... [APP/PROC/WEB/0] ERR django.db.utils.OperationalError: unable to open database file
</pre>
<p>Uh oh, we didn&#8217;t initialise our database. At this point we need to change from using the file based SQLite database which will be purged (along with all other files) each time we push the application. Let&#8217;s fix this by using data services provided with CF.</p>
<p>First let&#8217;s create a PostgreSQL database. Here I&#8217;m using the free tier provided by ElephantSQL on Pivotal Web Services.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf marketplace
Getting services from marketplace in org ianhuston / space testing as XXX...
OK

service                       plans                                                                                description
...
elephantsql                   turtle, panda*, hippo*, elephant*                                                    PostgreSQL as a Service
...
* These service plans have an associated cost. Creating a service instance will incur this cost.

TIP:  Use &#039;cf marketplace -s SERVICE&#039; to view descriptions of individual plans of a given service.
</pre>
<p>Let&#8217;s look at the ElephantSQL plans in depth:</p>
<pre class="brush: bash; title: ; notranslate">
$ cf marketplace -s elephantsql
Getting service plan information for service elephantsql as XXX...
OK

service plan   description                                            free or paid
turtle         4 concurrent connections, 20MB Storage                 free
panda          20 concurrent connections, 2GB Storage                 paid
hippo          300 concurrent connections, 100 GB Storage             paid
elephant       300 concurrent connections, 1000 GB Storage, 500Mbps   paid
</pre>
<p>Looks like the turtle plan will suit us. Let&#8217;s create a service on that plan.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf create-service elephantsql turtle mydb
</pre>
<p>Next we attach this service to our app and restage as it suggests.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf bind-service ih-superlists mydb
$ cf restage ih-superlists
</pre>
<p>We can now see our database connection variable in the environment of our app.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf env ih-superlists
...
System-Provided:
{
 &quot;VCAP_SERVICES&quot;: {
  &quot;elephantsql&quot;: [
   {
    &quot;credentials&quot;: {
     &quot;max_conns&quot;: &quot;5&quot;,
     &quot;uri&quot;: SUPER_SECRET_URI
    },
    &quot;label&quot;: &quot;elephantsql&quot;,
    &quot;name&quot;: &quot;mydb&quot;,
    &quot;plan&quot;: &quot;turtle&quot;,
...
</pre>
<p>But how will our Django app know to use this database? We need to give these credentials to the application. One important thing to know is that the URI from the <code>VCAP_SERVICES</code> environmental variable will also be provided to our application in the <code>DATABASE_URL</code> variable. This is the same way Heroku apps receive database credentials and gives us the opportunity to use the small <a href="https://github.com/kennethreitz/dj-database-url/"><code>dj_database_url</code> library</a> from Kenneth Reitz.</p>
<p>Install the library using pip locally, add it to your requirements.txt and then let&#8217;s change our settings.</p>
<p><em>superlists/settings.py</em></p>
<pre class="brush: python; title: ; notranslate">
import dj_database_url
...
#DATABASES = {
#    &#039;default&#039;: {
#        &#039;ENGINE&#039;: &#039;django.db.backends.sqlite3&#039;,
#        &#039;NAME&#039;: os.path.join(BASE_DIR, &#039;../database/db.sqlite3&#039;),
#    }
#}

LOCAL_SQLITE=&#039;sqlite:///&#039; + os.path.abspath(os.path.join(BASE_DIR, &#039;../database/db.sqlite3&#039;))
DATABASES = {}
DATABASES[&#039;default&#039;] = dj_database_url.config(default=LOCAL_SQLITE)
</pre>
<p>The <code>dj_database_url.config</code> function automatically looks for the <code>DATABASE</code> environmental variable, and here we also give it a default to use when running locally. We should run our local tests again to check this still works.</p>
<p>Now we need to initialise our PostgreSQL database. We can do this using a once-off task with the relatively new <code>cf task</code> command. First push the application.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf push ih-superlists
</pre>
<p>Then run the database initialisation as a task.</p>
<pre class="brush: bash; title: ; notranslate">
$ cf run-task ih-superlists &quot;python manage.py migrate&quot; --name migrate
</pre>
<p>You can check the status of a task by looking at <code>$ cf tasks ih-superlists</code>.</p>
<p>Once the migration task is finished, we can run our functional tests again.</p>
<pre class="brush: bash; title: ; notranslate">
$ STAGING_SERVER=ih-superlists.cfapps.io python manage.py test functional_tests
</pre>
<p>Success!</p>
<p>Let&#8217;s make one final change to turn off debug mode.</p>
<p><em>superlists/settings.py</em></p>
<pre class="brush: python; title: ; notranslate">
DEBUG = False
</pre>
<h2>Summary</h2>
<p><img src="https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/python_cf.png" alt="Python &amp; CF" width="358" height="175" class="alignright size-full wp-image-772" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/python_cf.png 358w, https://www.ianhuston.net/blog2/wp-content/uploads/2017/10/python_cf-300x147.png 300w" sizes="(max-width: 358px) 100vw, 358px" /><br />
We walked through a few steps there to get our Django app up and running on Cloud Foundry. Some of these are CF specific, and some are more about making our Django app more &#8216;cloud native&#8217; in the spirit of the <a href="https://12factor.net/">12 factors</a>. All the changes we made can be seen <a href="https://github.com/ihuston/tdd_with_python_book_examples/commit/5bee0b579f0a11ca650226fb67d8ae7d15d7e381">in this commit</a>. You can also see <a href="https://github.com/ihuston/tdd_with_python_book_examples/tree/5bee0b579f0a11ca650226fb67d8ae7d15d7e381">all the code</a> for the CF-enabled version of the Superlists app so far.</p>
<p>Let&#8217;s recap:</p>
<ol>
<li>Create a manifest.yml file with CF specific information.</li>
<li>Create a runtime.txt file to specify Python version.</li>
<li>Add your expected URL to <code>ALLOWED_HOSTS</code></li>
<li>Use Whitenoise to serve static files.</li>
<li>Use a data service to create a database and connect it to Django.</li>
<li>Initialise the database and run all migrations.</li>
<li>Turn off debug mode.  </li>
<li><code>cf push</code> your way to Django on CF!</li>
</ol>
<p>Hopefully this is useful for you to get your Django app running on Cloud Foundry. Let me know in the comments if you have any other tips!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2017/10/bringing-django-to-cloud-foundry/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">747</post-id>	</item>
		<item>
		<title>Mapping Dublin parish boundaries</title>
		<link>https://www.ianhuston.net/2017/04/mapping-dublin-parish-boundaries/</link>
					<comments>https://www.ianhuston.net/2017/04/mapping-dublin-parish-boundaries/#comments</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Mon, 03 Apr 2017 20:49:54 +0000</pubDate>
				<category><![CDATA[Data Science]]></category>
		<category><![CDATA[census]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Dublin]]></category>
		<category><![CDATA[geojson]]></category>
		<category><![CDATA[map]]></category>
		<guid isPermaLink="false">https://www.ianhuston.net/?p=720</guid>

					<description><![CDATA[TLDR: Go straight to the Dublin Parish Boundaries map [new URL April 2020]. In Ireland, most primary schools are run by the Catholic Church and the rules for enrolling often include complex lists of rules with those in the local parish often being preferred. This means when you are looking for accommodation to rent or <a class="read-more" href="https://www.ianhuston.net/2017/04/mapping-dublin-parish-boundaries/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>TLDR: Go straight to the <a href="https://ihuston.github.io/dublin_parishes/">Dublin Parish Boundaries map</a> [new URL April 2020].</p>
<p>In Ireland, most primary schools <a href="https://en.wikipedia.org/wiki/Religious_education_in_the_Republic_of_Ireland#Church_schools">are run by the Catholic Church</a> and the rules for enrolling often include complex lists of rules with those in the local parish often being preferred. This means when you are looking for accommodation to rent or buy it can be very important to know in advance which parish the property is located in.</p>
<p>The Dublin Archdiocese has a map of all the <a href="www.dublindiocese.ie/parishes/church-map/">churches in Dublin</a> but unfortunately it doesn&#8217;t seem to be working at the moment. Individual parishes sometimes <a href="http://www.donnybrookparish.ie/parish-contacts/259-parish-boundaries-map.html">have maps</a> although these are often either static scanned documents or sometimes even hand-drawn sketches.</p>
<p>So how can we make these parish boundaries available on a modern map interface?</p>
<p>Fortunately for our purposes, the Catholic parishes are such an integral part of Irish society that the national Central Statistics Office reports their boundaries as part of its census data. This data is available under a <a href="http://census.cso.ie/censusasp/saps/boundaries/ED_SA%20Disclaimer1.htm">custom non-commercial license</a> from <a href="http://www.osi.ie">Ordnance Survey Ireland</a>.</p>
<p>The data the CSO provide is in the form of <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefiles</a> but we can convert them to the more palatable <a href="https://en.wikipedia.org/wiki/GeoJSON">GeoJSON</a> format using the ogr2ogr utility from <a href="https://en.wikipedia.org/wiki/GDAL">GDAL</a>:</p>
<pre><code>ogr2ogr -f GeoJSON -t_srs crs:84 new_file.geojson original_file.shp
</code></pre>
<p>Github provides a <a href="https://help.github.com/articles/mapping-geojson-files-on-github/">really useful GeoJSON renderer</a> on their site but also for embedded maps. This means we don&#8217;t have to worry about creating a map and adding the parish boundaries as a layer.</p>
<p>The final piece of the puzzle is how to make the map available on the web. For this I used <a href="http://cloudfoundry.org">Cloud Foundry</a> and in particular Pivotal&#8217;s hosted Cloud Foundry instance called <a href="http://run.pivotal.io">Pivotal Web Services</a>. [Disclaimer: I work for Pivotal but not on Cloud Foundry.]</p>
<p>I made a simple HTML page and using the <a href="http://docs.cloudfoundry.org/buildpacks/staticfile/index.html">Staticfile buildpack</a> I was able to just do <code>cf push</code> to get the Dublin parish boundaries map up and running.</p>
<p>[Update April 2020: I&#8217;ve now relocated <a href="https://ihuston.github.io/dublin_parishes/">the map to Github pages</a>.]</p>
<div id="attachment_723" style="width: 882px" class="wp-caption alignright"><a href="https://dublin-parishes.cfapps.io/"><img aria-describedby="caption-attachment-723" class="wp-image-723 size-full" src="https://www.ianhuston.net/blog2/wp-content/uploads/2017/04/Dublin-parish-map.png" alt="" width="872" height="580" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2017/04/Dublin-parish-map.png 872w, https://www.ianhuston.net/blog2/wp-content/uploads/2017/04/Dublin-parish-map-300x200.png 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2017/04/Dublin-parish-map-768x511.png 768w" sizes="(max-width: 872px) 100vw, 872px" /></a><p id="caption-attachment-723" class="wp-caption-text">The final GeoJSON map as rendered by <a href="http://github.com">Github</a></p></div>
<p>One note of caution: the parish boundaries in the Census data may not correspond to those used by parishes or schools so please double check carefully before making any life-changing decisions!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2017/04/mapping-dublin-parish-boundaries/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">720</post-id>	</item>
		<item>
		<title>Operationalising Data Science on Cloud Foundry</title>
		<link>https://www.ianhuston.net/2016/11/operationalising-data-science-on-cloud-foundry/</link>
					<comments>https://www.ianhuston.net/2016/11/operationalising-data-science-on-cloud-foundry/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Fri, 11 Nov 2016 10:49:56 +0000</pubDate>
				<category><![CDATA[Conferences and Meetings]]></category>
		<category><![CDATA[Data Science]]></category>
		<category><![CDATA[CloudFoundry]]></category>
		<category><![CDATA[operationalisation]]></category>
		<category><![CDATA[talk]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=705</guid>

					<description><![CDATA[This talk at the European Cloud Foundry Summit 2016 discusses the state of data science on Cloud Foundry, and outlines different deployment strategies for data science models.]]></description>
										<content:encoded><![CDATA[<p>This talk at the European <a href="http://cfsummit.com">Cloud Foundry Summit</a> 2016 discusses the state of data science on <a href="http://cloudfoundry.org">Cloud Foundry</a>, and outlines different deployment strategies for data science models.</p>
<iframe class='youtube-player' width='640' height='360' src='https://www.youtube.com/embed/YrRRwySALCo?version=3&#038;rel=0&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe>
<p><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="438" id="talk_frame_361343" mozallowfullscreen="true" src="//speakerdeck.com/player/57bfe63ff53945b28bbabe302f379691" style="border:0; padding:0; margin:0; background:transparent;" webkitallowfullscreen="true" width="500"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2016/11/operationalising-data-science-on-cloud-foundry/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">705</post-id>	</item>
		<item>
		<title>Snakes in a Buildpack</title>
		<link>https://www.ianhuston.net/2016/11/snakes-in-a-buildpack/</link>
					<comments>https://www.ianhuston.net/2016/11/snakes-in-a-buildpack/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Fri, 11 Nov 2016 10:44:51 +0000</pubDate>
				<category><![CDATA[Conferences and Meetings]]></category>
		<category><![CDATA[Data Science]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[buildpack]]></category>
		<category><![CDATA[CloudFoundry]]></category>
		<category><![CDATA[conda]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=699</guid>

					<description><![CDATA[This talk at the European Cloud Foundry Summit 2016 describes the work to include Conda as part of the official Python buildpack for Cloud Foundry. With this new buildpack you can install PyData packages like NumPy, SciPy and Scikit-Learn with ease in your Cloud Foundry applications. You can get started with my tutorial about Python <a class="read-more" href="https://www.ianhuston.net/2016/11/snakes-in-a-buildpack/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>This talk at the European <a href="http://cfsummit.com">Cloud Foundry Summit</a> 2016 describes the work to include <a href="http://conda.pydata.org">Conda</a> as part of the <a href="https://github.com/cloudfoundry/python-buildpack/">official Python buildpack</a> for <a href="http://cloudfoundry.org">Cloud Foundry</a>.</p>
<p>With this new buildpack you can install <a href="http://pydata.org">PyData</a> packages like <a href="http://numpy.org">NumPy</a>, <a href="http://scipy.org">SciPy</a> and <a href="http://scikit-learn.org">Scikit-Learn</a> with ease in your Cloud Foundry applications. You can get started with my tutorial about <a href="https://github.com/ihuston/python-cf-examples">Python on Cloud Foundry</a>.</p>
<iframe class='youtube-player' width='640' height='360' src='https://www.youtube.com/embed/1PBEQAyehuk?version=3&#038;rel=0&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe>
<p style="text-align: center;">
<p><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="438" id="talk_frame_367869" mozallowfullscreen="true" src="//speakerdeck.com/player/367f2fefb12d418f80b7623f32df4c86" style="border:0; padding:0; margin:0; background:transparent;" webkitallowfullscreen="true" width="500"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2016/11/snakes-in-a-buildpack/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">699</post-id>	</item>
		<item>
		<title>Data Science In the Balanced Team</title>
		<link>https://www.ianhuston.net/2016/11/data-science-in-the-balanced-team/</link>
					<comments>https://www.ianhuston.net/2016/11/data-science-in-the-balanced-team/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Mon, 07 Nov 2016 17:17:44 +0000</pubDate>
				<category><![CDATA[Data Science]]></category>
		<category><![CDATA[balanced team]]></category>
		<category><![CDATA[data science]]></category>
		<category><![CDATA[Pivotal Labs]]></category>
		<category><![CDATA[product design]]></category>
		<category><![CDATA[product management]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=654</guid>

					<description><![CDATA[This year I was fortunate enough to speak at PyCon Ireland 2016 in Dublin.  This was a great event with lots of interesting Python based talks and a full PyData track over the two days. The topic of my talk was something I&#8217;ve been thinking about a lot over the last few years: how data scientists <a class="read-more" href="https://www.ianhuston.net/2016/11/data-science-in-the-balanced-team/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0.jpg"><img class="alignright wp-image-655 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0-300x169.jpg" alt="ian-huston-data-science-in-the-balanced-team-0" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0-300x169.jpg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0-768x432.jpg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0-1024x575.jpg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-0.jpg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>This year I was fortunate enough to speak at <a href="https://python.ie/pycon-2016/">PyCon Ireland 2016</a> in Dublin.  This was a great event with lots of interesting Python based talks and a full <a href="http://pydata.org">PyData</a> track over the two days. The topic of my talk was something I&#8217;ve been thinking about a lot over the last few years: how data scientists can work with other disciplines.</p>
<p>Recently designers and product managers have begun working more closely with development teams, and in my opinion there are many lessons that data scientists can learn from this experience. In particular the concept of a &#8220;Balanced Team&#8221; appeals to me as a template for data scientists.</p>
<p>The slides for this talk <a href="https://speakerdeck.com/ihuston/data-science-in-the-balanced-team">are on SpeakerDeck</a>, and the video <a href="https://www.youtube.com/watch?v=WrndtgVvWXU">is also available</a>. In this post I want to recap my argument from the talk with some extended notes.</p>
<h2>From Imposter Syndrome to Team Player</h2>
<p><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1.jpeg"><img class="alignright wp-image-656 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-1" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>I work as a data scientist at <a href="http://pivotal.io/labs">Pivotal Labs</a> helping clients, often large enterprises, to bring data science into their business. However, I really started working with data when I was an academic, handling results from numerical simulations of the early universe.</p>
<div id="attachment_657" style="width: 310px" class="wp-caption alignright"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2.jpeg"><img aria-describedby="caption-attachment-657" class="wp-image-657 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2-300x169.jpeg" alt="David Whittaker's Imposter Syndrome post" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-2.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-657" class="wp-caption-text">David Whittaker&#8217;s Imposter Syndrome <a href="https://twitter.com/rundavidrun/status/587671657193455616">post</a></p></div>
<p>For a lot of people in academia, the concept of imposter syndrome is very familiar, and for me academia was a long process of dealing with imposter syndrome. <span style="font-weight: 400;">This is the idea that you aren&#8217;t really good enough to be here and someday someone is going to figure it out. </span><a href="https://twitter.com/rundavidrun/status/587671657193455616">This post by David Whittaker</a> captures what is really happening. Though you may think everyone knows more than you, really you are just observing the combined knowledge of a lot of different people.</p>
<p>As an academic it was easy to think that others in my field or outside in industry must be handling these data problems in a better way. I had done some formal computer science training in my undergrad degree, but I&#8217;d taught myself how to use <a href="http://numpy.org">scientific</a> <a href="http://scipy.org">Python</a> tools and <a href="http://software-carpentry.org/">software carpentry practices</a>.</p>
<div id="attachment_658" style="width: 310px" class="wp-caption alignright"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3.jpeg"><img aria-describedby="caption-attachment-658" class="wp-image-658 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-3" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-3.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-658" class="wp-caption-text"><a href="http://twitter.com/datascienceuni">The Data Science Unicorn</a></p></div>
<p>When I left academia to work as a data scientist my first steps <span style="font-weight: 400;">were working on solo projects where I was often expected to be a <a href="http://twitter.com/datascienceuni">data science unicorn</a>. </span><span style="font-weight: 400;">These type of projects involve a lot of pressure and the full weight of stakeholder expectations rests solely on you. It’s not a comfortable position to be in. Due to the hype around data science there was very little understanding by business stakeholders of the exploratory nature of much data science work, where positive results are not a guaranteed. </span></p>
<p>[By the way, the <a href="https://twitter.com/datascienceuni">Data Science Unicorn</a> is a real account, with a collection of data science learning material gathered by <a href="https://twitter.com/JasonByrnePhD">Jason Byrne</a>.]</p>
<p><a href="http://www.ianhuston.net/?attachment_id=659"><img class="alignright wp-image-659 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-4-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-4" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-4-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-4-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-4-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-4.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>Working solo on projects is very draining, so more recently I&#8217;ve been fortunate to find myself working at Pivotal in teams including developers, product designers and product managers. We opened <a href="http://pivotal.io/locations/dublin">our Dublin office</a> last year <a href="https://www.youtube.com/watch?v=6z4qP6tU_5k">on Back To The Future Day</a>, hence the branded De Lorean, and we are always looking for people with <a href="http://engineering.pivotal.io/post/abstraction-or-the-gift-of-our-weak-brains/">empathy</a> to <a href="https://pivotal.io/careers">join us</a>.</p>
<p>Working as part of a team has been great, and I&#8217;ve been able to learn a lot about how modern software is built. In particular I&#8217;ve been interested in how disciplines <span style="font-weight: 400;">like design and product management have been integrated with more traditional development including a concept called the &#8220;Balanced Team&#8221;.</span></p>
<h2>Balanced Team</h2>
<div id="attachment_660" style="width: 310px" class="wp-caption alignright"><a href="http://www.slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering"><img aria-describedby="caption-attachment-660" class="wp-image-660 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-5-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-5" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-5-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-5-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-5-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-5.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-660" class="wp-caption-text">Image from <a href="slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering">Janice Fraser&#8217;s slides</a></p></div>
<p>The idea for <a href="http://www.balancedteam.org/">Balanced Team</a> came from conversations between developers and product teams who had been working in an agile methodology but were seeing problems integrating design and product management. As I understand it, the main idea behind Balanced Team is to share responsibility between the team and make sure everyone is acting in service to the team, not just their own self interest. <a href="https://twitter.com/clevergirl">Janice Fraser</a> played a central role in formulating these ideas and explains them in more detail in <a href="http://tinyurl.com/jfraser">this talk</a>.</p>
<p>This image from <a href="http://www.slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering">her slides</a> shows that the main roles represented in a balanced team are development, design and product management. Each role has obligations and an authority which they bring to any interactions. Fraser describes Balanced Team as more of a work environment than a methodology, essentially a frame of mind about how the team should interact.</p>
<p>In the past product designers have been kept entirely separate from development teams, often in specialised design agencies. They were frequently required to act as &#8220;hero designers&#8221;, unable to admit any faults and working hard in crunch mode to meet deadlines. It was striking for me to see the similarities with the expectations on data science unicorns. Some of the goals of Balanced Team are to get away from this notion of hero designers, to reduce power struggles and allow more space for people to speak freely and discard failing solutions.</p>
<div id="attachment_661" style="width: 310px" class="wp-caption alignright"><a href="http://www.slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering"><img aria-describedby="caption-attachment-661" class="wp-image-661 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-6-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-6" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-6-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-6-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-6-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-6.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-661" class="wp-caption-text">Text from <a href="slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering">Janice Fraser&#8217;s slides</a></p></div>
<p>In her talk Fraser describes the obligations and authority for each of the roles. For example the designer in the team needs to be the &#8220;empathizer-in-chief&#8221;, who understands the customer at an expert level, and can translate their high-value needs into product decisions. Their obligations to the team include honing their craft (as a service to the team) and facilitating balance between other parties within the team. Their main authority is the prioritisation of customer problems in every product conversation.</p>
<div id="attachment_662" style="width: 310px" class="wp-caption alignright"><a href="https://medium.com/art-marketing/data-literacy-product-design-and-the-many-faced-god-cf8339e035a#.i8ry0xhqv"><img aria-describedby="caption-attachment-662" class="wp-image-662 size-medium" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-7-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-7" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-7-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-7-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-7-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-7.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-662" class="wp-caption-text">Monica Rogati&#8217;s <a href="https://medium.com/art-marketing/data-literacy-product-design-and-the-many-faced-god-cf8339e035a#.i8ry0xhqv">&#8216;data thinking&#8217; post</a></p></div>
<p>It&#8217;s worth noting that as it is currently formulated, the Balanced Team concept does not include any data oriented role. <a href="http://twitter.com/mrogati">Monica Rogati</a> described what happens in this situation in her recent <a href="https://medium.com/art-marketing/data-literacy-product-design-and-the-many-faced-god-cf8339e035a#.8z48rta8k">post on &#8220;data thinking&#8221;</a>. Rogati talks about how Apple&#8217;s Photos product can identify faces in your photo collection and highlights a list of 5 of these people in <strong>alphabetical</strong> order. Depending on their name, this means your closest friends and family might not appear in the top 5 listing, despite perhaps appearing in most of your photos.</p>
<p>As Rogati describes, a simple application of data thinking, with no complex machine learning or predictive analytics, would reorder these photos in frequency order. The take-away recommendation is that to avoid these product mistakes &#8220;you need data thinking to be part of the culture and top of mind, not an after-thought.&#8221;</p>
<h2>Things that worked<img class="alignright size-medium wp-image-663" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-8-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-8" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-8-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-8-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-8-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-8.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></h2>
<p>With this in mind, as a data scientist, I wondered how I would describe my obligations and authority. I&#8217;ve been fortunate to have worked over the last two years in teams with developers, designers and PMs, and in this time we&#8217;ve tried different approaches to bringing data science into this process. I&#8217;m going to describe some of the approaches that worked for us, some that didn&#8217;t, and then try to distill what I&#8217;ve learned into a similar form to Janice Fraser&#8217;s blueprint.</p>
<p><span style="font-weight: 400;"><img class="alignright size-medium wp-image-664" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-9-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-9" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-9-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-9-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-9-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-9.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" />User research seeks to find the right direction to head in the space of possible products. </span><span style="font-weight: 400;">As part of a balanced team the data scientist has an obligation to use available data to inform lines of questioning for in-person interviews, validate the results of these interviews and identify gaps when interviewees are not representative. It&#8217;s great to observe these user interview sessions as a data scientist, because I always come out with a long list of questions to answer from the data. </span></p>
<p><span style="font-weight: 400;">A data scientist can also guide user research questions in order to understand the type of predictive models that will be suitable, answering questions about how much &#8216;explanability&#8217; is needed, and where the line is between useful &amp; creepy for instance.</span></p>
<p><span style="font-weight: 400;"><img class="alignright size-medium wp-image-665" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-10-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-10" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-10-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-10-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-10-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-10.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" />If your product manager has not worked with a data scientist before, you need to make a big effort to help them understand how you can contribute to the product. </span><span style="font-weight: 400;">If they don’t understand how machine learning and predictive analysis can be effectively used, they will not direct the product discussion to include them.</span></p>
<p><span style="font-weight: 400;">As part of a balanced team you have an obligation to be part of all product conversations and story generation and to proactively suggest where data thinking could be most effective. </span><span style="font-weight: 400;">Don’t wait for someone to come to you with an idea ‘perfect for some data science’.</span></p>
<p><span style="font-weight: 400;"><img class="alignright size-medium wp-image-666" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-11-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-11" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-11-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-11-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-11-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-11.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" />Expanding this idea of education, your team will make most effective use of data when ‘data thinking’ is central to the culture and practices of the team. </span><span style="font-weight: 400;">If they have not been exposed to this before you will need to educate and involve them in understanding the available data and analysis techniques you are using. </span><span style="font-weight: 400;">Pairing goes some way to sharing this knowledge, and you can also consider having a ‘show &amp; tell’ to describe data discoveries and explain the moving parts of the model you are building.</span></p>
<p>As part of a balanced team, you have an obligation to educate your team about the techniques you&#8217;re using, the data that is available and what choices you have made in your analysis. The goal is not scrutiny of your work, but building confidence in your approach and results.</p>
<p><span style="font-weight: 400;"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12.jpeg"><img class="alignright size-medium wp-image-667" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-12" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-12.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>At Pivotal we think Pair Programming is the <a href="https://blog.pivotal.io/labs/labs/pair-programming-considered-extremely-beneficial">best way to get fast feedback cycles and share knowledge</a>. Data science is no different and we <a href="http://engineering.pivotal.io/post/pairing-on-data-science/">pair as data scientists</a> when possible. We also like to pair with developers and designers to share knowledge of our methods and also get a new perspective on what we are building.</span></p>
<p><span style="font-weight: 400;">Pairing with developers is particularly useful to continue the journey from exploratory analysis to production code.</span></p>
<p>&nbsp;</p>
<h2>Things that did not work</h2>
<p><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13.jpeg"><img class="alignright size-medium wp-image-668" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-13" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-13.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>Now let&#8217;s consider a few things that we&#8217;ve tried, or experienced as part of a team in the past.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14.jpeg"><img class="alignright size-medium wp-image-669" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-14" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-14.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>In one project we tried to keep our user stories unified from front to backend so overall user value would be apparent. This means that whenever we deliver a story we know that we&#8217;ve put together everything necessary for the user to benefit from this feature. Unfortunately it proved quite difficult to work with these large stories in practice.</span></p>
<p><span style="font-weight: 400;">For one thing, having a single scale for estimation proved difficult to work with and our stories soon became too big to reliably show incremental progress to stakeholders, increasing communication difficulties. </span><span style="font-weight: 400;">We eventually moved to having separate backlogs, which we already had for design work, although this means extra effort needed to keep backlogs in sync.</span></p>
<p><span style="font-weight: 400;">As part of a balanced team, the data scientist will need to take part in conversations about the engineering backlog (as well as design), a</span><span style="font-weight: 400;">nd the PM will need to have a good handle on the inter-dependencies between backlogs.</span></p>
<p><span style="font-weight: 400;"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15.jpeg"><img class="alignright size-medium wp-image-670" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-15" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-15.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>There’s sometimes a tendency to think data scientists should only arrive on a project once an MVP is built and some (usually limited) data is being collected. </span><span style="font-weight: 400;">Even when machine learning is going to be at the core of a product, such as predictive maintenance, there’s sometimes a reluctance to bring data scientists/ML engineers in early on during the product creation phase.</span></p>
<p><span style="font-weight: 400;">This denies the data scientist the chance to be involved in the early conversations about the feasibility of different product directions, give advice on what early instrumentation to include, and provide context using any existing data sets in the business. </span><span style="font-weight: 400;">As part of a balanced team, I think it’s clear that data scientists can contribute from the very beginning of the project and should ask to join the early product creation.</span></p>
<p><span style="font-weight: 400;"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16.jpeg"><img class="alignright size-medium wp-image-671" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-16" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-16.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>As expensive and expert resources there is a tendency to spread data scientists across multiple projects to maximise their effectiveness. Continually</span><span style="font-weight: 400;"> switching contexts and juggling multiple simultaneous top priorities makes this path more inefficient for team progress as a whole. </span><span style="font-weight: 400;">This lesson has been learned with designers, product managers and others, but now seems to need to be learned again for data scientists.</span></p>
<p><span style="font-weight: 400;">Being part of a balanced team means putting the team’s success first, which means being available and focused on a single team, a single product. This can result in what feels like inefficient use of your time if you’re not occupied 100%, but the alternative cost to the team of not having you available at the right moment is more detrimental. One way to justify this perceived inefficiency is to calculate the time &amp; money wasted by a development team waiting for their shared data scientist to become available. Often what could have been a simple ten minute conversation can instead turn into days of emails, conference call scheduling and meeting planning, all because the data scientist is juggling other projects.</span></p>
<p><span style="font-weight: 400;"><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17.jpeg"><img class="alignright size-medium wp-image-672" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17-300x169.jpeg" alt="ian-huston-data-science-in-the-balanced-team-17" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17-300x169.jpeg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17-768x432.jpeg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17-1024x575.jpeg 1024w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-17.jpeg 1500w" sizes="(max-width: 300px) 100vw, 300px" /></a>There is so much hype around data science that it can feel like management expect the addition of a data scientist to instantly solve all existing problems. </span><span style="font-weight: 400;">This is a dangerous situation to get into, and you must work to manage expectations, especially when starting to work on a new problem with many uncertainties. </span><span style="font-weight: 400;">As part of a balanced team, the data scientist has a responsibility to inform the team’s expectations, and gains by sharing the burden of communicating and managing expectations with outside stakeholders.</span></p>
<p><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team.jpg"><img class="alignright size-medium wp-image-685" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-300x169.jpg" alt="ian-huston-data-science-in-the-balanced-team" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-300x169.jpg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-768x432.jpg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team.jpg 960w" sizes="(max-width: 300px) 100vw, 300px" /></a>I hope our experiences can help you as you explore the idea of including data science in your balanced product teams. There are many things that could be part of the core obligations of a data scientist in the framework that Janice Fraser describes for a Balanced Team. For me, the data scientist should be the &#8220;voice of data&#8221; on the team. They should provide deep expertise and understanding about the available data, and be able to identify potential valuable uses and techniques.</p>
<p>More and more we are seeing the implications of unethical uses of data and the data scientist should have the obligation to guard against unjustified (legally and mathematically), unethical and inappropriate uses of data. On the other hand where data is not currently being collected or is insufficient for future uses, the data scientist has an obligation to the team to begin collecting data to facilitate expected future product goals. In addition, data scientists can also facilitate balance in the team. Were I to include another obligation, it would be to &#8220;hone your craft&#8221; as Janice Fraser describes explicitly for designers.</p>
<p>For me the important authority that a data scientist brings to the team is the ability to improve product conversations with &#8216;data thinking&#8217; as Monica Rogati suggests. We can make data thinking a natural part of product decisions, in order to reduce the sort of data literacy problems highlighted above.</p>
<p><span style="color: #999999;"><em>[In the original talk the final two slides had references to &#8220;data&#8221; instead of &#8220;data thinking&#8221;.]</em></span></p>
<p>&nbsp;</p>
<h2>Summary</h2>
<p><a href="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1.jpg"><img class="alignright size-medium wp-image-687" src="http://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-300x169.jpg" alt="ian-huston-data-science-in-the-balanced-team-1" width="300" height="169" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-300x169.jpg 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1-768x432.jpg 768w, https://www.ianhuston.net/blog2/wp-content/uploads/2016/11/Ian-Huston-Data-Science-in-the-Balanced-Team-1.jpg 960w" sizes="(max-width: 300px) 100vw, 300px" /></a>To recap, I think there&#8217;s a lot of value in bringing data scientists into your balanced team. This helps make data thinking a central part of the product conversation. The data scientist has the obligation to provide data insights and explore potential uses, all in service to the team. In effect we are trying to break down the walls between data scientists and the rest of the product team.</p>
<p>Thank you to all the great people I&#8217;ve worked with as we&#8217;ve learned how data science contributes as part of a product team, from Pivotal and our client teams. In particular, I want to thank Janice Fraser for allowing me to reuse and adapt material from her <a href="http://tinyurl.com/jfraser">Balanced Team talk</a> <a href="http://slideshare.net/clevergirl/2015-balanced-teams-product-management-engineering">slide-deck</a>.</p>
<p>I hope that this is only the start of the conversation about Data Science in the Balanced Team and I look forward to hearing how data scientists are making &#8216;data thinking&#8217; a central part of their product team&#8217;s work.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2016/11/data-science-in-the-balanced-team/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">654</post-id>	</item>
		<item>
		<title>Towards Cloud Native Data Science</title>
		<link>https://www.ianhuston.net/2015/11/towards-cloud-native-data-science/</link>
					<comments>https://www.ianhuston.net/2015/11/towards-cloud-native-data-science/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Tue, 17 Nov 2015 18:08:41 +0000</pubDate>
				<category><![CDATA[Conferences and Meetings]]></category>
		<category><![CDATA[Data Science]]></category>
		<category><![CDATA[cloud native]]></category>
		<category><![CDATA[cloud native applications]]></category>
		<category><![CDATA[cloud native data science]]></category>
		<category><![CDATA[talk]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=635</guid>

					<description><![CDATA[In my talk at ODSC West I wanted to start a conversation about what if any value the idea of Cloud Native Applications has for data science. The video and slides from my presentation are below and the slides are also available without speaker notes. If you haven&#8217;t heard of Cloud Native Applications, the idea <a class="read-more" href="https://www.ianhuston.net/2015/11/towards-cloud-native-data-science/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>In my talk at <a href="http://www.ianhuston.net/2015/11/odsc-west-day-one/">ODSC West</a> I wanted to start a conversation about what if any value the idea of Cloud Native Applications has for data science. The video and slides from my presentation are below and the slides are also available <a href="https://speakerdeck.com/ihuston/a-personal-journey-towards-cloud-native-data-science">without speaker notes</a>.</p>
<p>If you haven&#8217;t heard of Cloud Native Applications, the idea is to write applications that take full advantage of the benefits of cloud deployment and understand the limitations and constraints of the platform.<br />
<span id="more-635"></span><br />
Some of these suggested practices have been collected into a list of <a href="http://12factor.net">12 &#8216;factors&#8217;</a> which include making your app <a href="http://12factor.net/processes">stateless</a>, explicitly declaring <a href="http://12factor.net/dependencies">dependencies</a> and ensuring parity between <a href="http://12factor.net/dev-prod-parity">development and production environments</a>. My colleague at Pivotal gives a good introduction to the topic in this <a href="http://www.oreilly.com/programming/free/migrating-cloud-native-application-architectures.csp">free O&#8217;Reilly book</a>.</p>
<p>I want to figure out what additional factors are specific to data science and in my talk I identified an initial list of three:</p>
<ul>
<li>Reproducibility of models,</li>
<li>Models exposed as services,</li>
<li>Explicit configuration of data pipelines.</li>
</ul>
<p>I&#8217;d be really interested in hearing other ideas for the list and any other comments. You can contact me via Twitter or through the comments below. <em>Update: The video of the talk is <a href="https://www.youtube.com/watch?v=2ITtyq83qJw">now up</a>.</em></p>
<p><iframe class='youtube-player' width='640' height='360' src='https://www.youtube.com/embed/2ITtyq83qJw?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p><script async class="speakerdeck-embed" data-id="79a34832298f452aba367eafdeeec08c" data-ratio="0.707182320441989" src="//speakerdeck.com/assets/embed.js"></script></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2015/11/towards-cloud-native-data-science/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">635</post-id>	</item>
		<item>
		<title>ODSC West Day Two</title>
		<link>https://www.ianhuston.net/2015/11/odsc-west-day-two/</link>
					<comments>https://www.ianhuston.net/2015/11/odsc-west-day-two/#comments</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Mon, 16 Nov 2015 04:11:57 +0000</pubDate>
				<category><![CDATA[Conferences and Meetings]]></category>
		<category><![CDATA[Data Science]]></category>
		<category><![CDATA[odsc]]></category>
		<category><![CDATA[opendatascience]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=630</guid>

					<description><![CDATA[After a great first day, ODSC West started up again on a blustery Sunday morning in the Bay Area. As I needed to prepare for my own talk I didn&#8217;t get to see as many of the other sessions as I would have liked, but I&#8217;ve collected some thoughts on those that I did see. <a class="read-more" href="https://www.ianhuston.net/2015/11/odsc-west-day-two/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p>After a great <a href="http://www.ianhuston.net/2015/11/odsc-west-day-one/">first day</a>, ODSC West started up again on a blustery Sunday morning in the Bay Area. As I needed to prepare for my own talk I didn&#8217;t get to see as many of the other sessions as I would have liked, but I&#8217;ve collected some thoughts on those that I did see.</p>
<p><span id="more-630"></span></p>
<h3><a href="https://twitter.com/wesmckinn">Wes McKinney</a>, <a href="http://cloudera.com">Cloudera</a></h3>
<p>Wes is best known for creating the Pandas library for data analysis in Python and was talking about his successor project, Ibis, which aims to remove the unnecessary complications of SQL based analysis by providing a uniform Python based interface similar to Pandas.</p>
<p>One reason for starting a new project is the amount of technical debt accrued by Pandas which means it&#8217;s &#8220;hard to make Pandas magically big data enabled.&#8221; Other &#8216;big data&#8217; efforts to use Python such as in user defined functions like PL/Python are hampered by the need to move data between the database and the Python process. Ibis will have a shared memory architecture removing this bottleneck and Wes is looking for contributors to help with implementing interfaces to more databases beyond the current focus on SQLite and Impala.</p>
<h3><a href="https://twitter.com/antgoldbloom">Anthony Goldbloom</a>, <a href="http://kaggle.com">Kaggle</a></h3>
<p>As the founder of Kaggle, Anthony Goldbloom has seen over 400,000 data scientists try their hand at winning a competition. He shared some tips on what makes a good Kaggle competition and how the top performers attack a problem.</p>
<p>In particular he suggested that those at the top of the leaderboard fall into one of two camps. The first group like very structured datasets and spend almost all their time hand-crafting better features to input into their model. Recently this group has overwhelmingly switched to using the <a href="https://github.com/dmlc/xgboost">XGBoost algorithm</a> instead of their previous favourite, Random Forests.</p>
<p>The second group focus on unstructured data problems and spend no time on feature engineering, instead building neural networks. For image based competitions, convolutional neural nets work well for edge detection, and time series data is best tackled with recurrent neural nets. Given the hype recently around deep learning it&#8217;s interesting to see the widespread use of neural nets for these tasks, but also that structured problems still need a more traditional feature based approach.</p>
<p>Anthony also previewed the new Scripts feature of Kaggle which will allow anyone to upload their model code and have it run (for free) in a containerised environment. Other competitors will be able to fork the code and immediately run their modified version on the same inputs. One interesting twist is that anyone uploading their code has to license it under the Apache 2 License, so the code will be open for anyone to reuse.</p>
<h3>Owen Zhang, <a href="http://datarobot.com">DataRobot</a></h3>
<p>Owen, who until recently was the number 1 competitor on Kaggle&#8217;s leaderboard, gave a really humourous walk through of how he transitioned from an IT role into data science. He says he was &#8220;legitimized&#8221; by Kaggle as it meant he could apply to new data science roles and prove his ability, instead of just making claims about how good a data scientist he <em>would</em> be given the chance.</p>
<p>His two important things to remember when working as a data scientist are:</p>
<ul>
<li>&#8220;Asking the right question is more important than getting the perfect answer.&#8221;</li>
<li>&#8220;What will/can you do differently if you have a prediction of X?&#8221;</li>
</ul>
<h3><a href="https://twitter.com/dontusethiscode">James Powell</a>, <a href="http://numfocus.org">NumFocus</a> &amp; many others</h3>
<p>Every talk by James is entertaining but this one was particularly fun and challenging, veering from very low level Python hacking to philosophical musings on the nature of human interactions as exhibited through code reviews. He also included a whole meta talk section describing the stages you go through before becoming a well known speaker travelling around the world:</p>
<ol>
<li>Start by talking about something someone else did.</li>
<li>Talk about a small library you worked on, or take something from another language and apply it to your own.</li>
<li>Talk about your ideas and opinions and have a clear message.</li>
<li>Already be famous because this increases how much the audience will pay attention.</li>
</ol>
<p>As a helpful hint for stage 4 he suggested that a simple way to become famous is to court controversy.</p>
<p>I can&#8217;t do justice to the multitude of ideas and concepts in this talk, so I&#8217;d recommend watching it (maybe more than once) when the video comes out.</p>
<h3>Thoughts on ODSC West</h3>
<p>For a new conference holding its first west coast event this was very well organised and managed to attract a large crowd of 1000 data scientists to a weekend event. The audience was definitely more on the practitioner end which is a refreshing change from the variety of marketing and sales based conferences proliferating in the data science and big data space.</p>
<p>Well done to Mammad, Sheamus, and the whole ODSC team for organising a great event and for their enthusiasm and helpfulness throughout the weekend.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2015/11/odsc-west-day-two/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">630</post-id>	</item>
		<item>
		<title>ODSC West Day One</title>
		<link>https://www.ianhuston.net/2015/11/odsc-west-day-one/</link>
					<comments>https://www.ianhuston.net/2015/11/odsc-west-day-one/#respond</comments>
		
		<dc:creator><![CDATA[Ian]]></dc:creator>
		<pubDate>Sun, 15 Nov 2015 22:53:19 +0000</pubDate>
				<category><![CDATA[Conferences and Meetings]]></category>
		<category><![CDATA[Data Science]]></category>
		<category><![CDATA[odsc]]></category>
		<category><![CDATA[opendatascience]]></category>
		<guid isPermaLink="false">http://www.ianhuston.net/?p=621</guid>

					<description><![CDATA[I&#8217;m out in San Francisco for the first time in months, to speak at the first Bay Area edition of the Open Data Science Conference. For a relatively new conference there is a great line-up of speakers and the audience is already quite big with around 1000 data scientists attending. The first day of talks <a class="read-more" href="https://www.ianhuston.net/2015/11/odsc-west-day-one/">Continue reading...</a>]]></description>
										<content:encoded><![CDATA[<p><a href="http://opendatascicon.com"><img src="http://www.ianhuston.net/blog2/wp-content/uploads/2015/11/odsc-300x71.png" alt="ODSC" width="300" height="71" class="alignright size-medium wp-image-622" srcset="https://www.ianhuston.net/blog2/wp-content/uploads/2015/11/odsc-300x71.png 300w, https://www.ianhuston.net/blog2/wp-content/uploads/2015/11/odsc.png 550w" sizes="(max-width: 300px) 100vw, 300px" /></a>I&#8217;m out in San Francisco for the first time in months, to speak at the first Bay Area edition of the <a href="http://opendatascicon.com">Open Data Science Conference</a>. For a relatively new conference there is a great line-up of speakers and the audience is already quite big with around 1000 data scientists attending.<br />
<span id="more-621"></span></p>
<p>The <a href="http://opendatascicon.com/detailed-schedule/#day1">first day</a> of talks was packed with really interesting sessions, and the slides and videos should be available in the next few weeks. In the meantime here&#8217;s my quick review of the talks I attended on Saturday:</p>
<h3><a href="https://twitter.com/ellisonbg">Brian Granger</a>, <a href="http://jupyter.org">Jupyter</a></h3>
<p>Brian is best known as the creator of the IPython Notebook, which has recently become the <a href="http://jupyter.org">Jupyter project</a>. Brian describes Jupyter as a tool for creating and sharing narratives and in his talk he outlined some of the new features that are coming in version 4.1 and beyond. Highlights of 4.1 include new multi-cell selections and actions and coming sometime after that will be a complete rewrite of the interface to enable third party plugins and <strong>collaborative editing</strong> (yay!).</p>
<p>In his talk Brian also challenged the audience to not simply define data science by the tools and skills necessary but rather by the fundamental questions that can be answered about the world. He also emphasised that data science can be pursued at any level and should be part of a general education and understanding of the world.</p>
<h3><a href="https://twitter.com/l2k">Lukas Biewald</a>, <a href="http://crowdflower.com">Crowdflower</a></h3>
<p>Lukas is the CEO of Crowdflower and gave two talks on Saturday outlining his views of how we can avoid a &#8216;data science winter&#8217; similar to the <a href="https://en.wikipedia.org/wiki/AI_winter">AI winters</a> of the 70s and 80s. As he noted, the strategy of big companies has changed and they now realise that amassing data is more important than building better algorithms. For example IBM recently bought Weather.com to get access to all the historical weather data they own, while at the same time Google feels confident enough to open source its distributed learning framework Tensorflow.</p>
<p>Lukas also discussed how human-in-the-loop based machine learning models are becoming increasingly popular, and expects this to be a standard practice in the industry within two years. Crowdflower helps companies enrich their datasets by getting real humans to perform classification or other tasks.</p>
<h3>Vin Sharma, <a href="http://www.intel.com">Intel</a></h3>
<p>Vin discussed how data science is in a proto-science phase and needs to make the transition to real science similar to the move from alchemy to chemistry. The friction Intel has identified in this move is around one-off models and legacy components, which slow down adoption of cloud based platforms. Vin also mentioned Intel&#8217;s new <a href="http://trustedanalytics.github.io/">Trusted Analytics Platform</a> which is based on <a href="http://cloudfoundry.org">Cloud Foundry</a>.</p>
<h3><a href="https://twitter.com/claudia_perlich">Claudia Perlich</a>, <a href="http://dstillery.com">dstillery</a></h3>
<p>Claudia works in ad-targeting and gave a really interesting talk about mismatched incentives when advertisers focus on simple metrics like click through rate. With the proliferation of bots clicking ads and even filling out forms (for example to schedule a test drive), it has become easier to predict the behaviour of the bots than real humans. As these bots build realistic browsing profiles, advertisers unwittingly spend money targeting them through auctions.</p>
<h3><a href="https://twitter.com/johnmyleswhite">John Myles White</a>, <a href="http://julialang.org">Julia</a></h3>
<p>John gave a really honest appraisal of the Julia language and what its strengths and weaknesses are. In the past I have heard a lot of enthusiasm about Julia which I never really understood, having played around with it a little. John&#8217;s explanation of this is the differing levels of maturity in the Julia stack for data acquisition, preparation and heterogeneous data tables, which are not really well supported, versus lower level numerical and matrix calculations in which Julia can achieve 100x or 1000x speedups in comparison with Python or R.</p>
<p>According to John, Julia version 1.0 which is coming in the next two years should see great improvements in the currently lacking areas.</p>
<h3><a href="https://twitter.com/j_houg">Juliet Hougland</a>, <a href="http://cloudera.com">Cloudera</a></h3>
<p>Juliet&#8217;s talk was an in-depth run through of problems people experience with PySpark, the Python bindings for Apache Spark, and her top tips to get better performance when using it. These included limiting the amount of data you pass to the Python processes by using the DataFrames API, making sure all your objects are serialisable by <a href="https://github.com/cloudpipe/cloudpickle">CloudPickle</a> (the pickling library used by PySpark), and making functions static to help isolate issues with serialisation.</p>
<p>In addition she recommends the use of the <a href="https://github.com/holdenk/spark-testing-base">SparkTestingBase</a> package to help write unit and integration tests for your application. This package provides helper functions which originally were used by the Spark dev team, for example to provide a SparkContext in each running test, which can either be set up freshly for each test, or shared between tests.</p>
<h3>Chris Colburn, <a href="http://netflix.com">Netflix</a></h3>
<p>Chris gave a great talk about the engineering issues faced by Netflix who serve over 100 million hours of video per day and collect over 500 billion events from consumer devices. To handle this, Netflix runs over 100 micro services and pushes new code over 40 times a day.</p>
<p>Chris outlined their efforts on anomaly detection and in particular the use of <a href="http://techblog.netflix.com/2015/02/rad-outlier-detection-on-big-data.html">Robust SVD and PCA</a> instead of the usual versions. He also mentioned that Netflix will soon release some work on stochastic testing, where probabilistic models can be tested to be within certain expected bounds.</p>
<h3>Don Dini, <a href="http://att.com">AT&amp;T</a></h3>
<p>Despite being mistaken for a physicist more than once, Don comes from a computational science background and discussed how the definition of Artificial Intelligence has changed over the decades following Larry Tesler&#8217;s aphorism that &#8216;AI is what hasn&#8217;t been done yet&#8217;.</p>
<p>Don described how search based planning for actions doesn&#8217;t scale well due to the exponential growth of the search space and how more probabilistic approaches are necessary.</p>
<h3>Day One Summary</h3>
<p>Overall the first day of ODSC West was really informative. There were a lot of other talks in <a href="http://opendatascicon.com/detailed-schedule/#day1">the schedule</a> across the different tracks, so I&#8217;m looking forward to checking out the videos when they&#8217;re released.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ianhuston.net/2015/11/odsc-west-day-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">621</post-id>	</item>
	</channel>
</rss>
