<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Patrick Michelberger on Medium]]></title>
        <description><![CDATA[Stories by Patrick Michelberger on Medium]]></description>
        <link>https://medium.com/@patrickmichelberger?source=rss-d9b3a7de1139------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sa4PVQM3dls9SPRBQlWDvQ.jpeg</url>
            <title>Stories by Patrick Michelberger on Medium</title>
            <link>https://medium.com/@patrickmichelberger?source=rss-d9b3a7de1139------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 16:53:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@patrickmichelberger/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to deploy a Serverless Machine Learning Microservice with AWS Lambda, AWS API Gateway and…]]></title>
            <link>https://medium.com/@patrickmichelberger/how-to-deploy-a-serverless-machine-learning-microservice-with-aws-lambda-aws-api-gateway-and-d5b8cbead846?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5b8cbead846</guid>
            <category><![CDATA[scikit-learn]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[serverless-architecture]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Sat, 10 Feb 2018 11:08:31 GMT</pubDate>
            <atom:updated>2018-03-10T18:48:47.591Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to deploy a Serverless Machine Learning Microservice with AWS Lambda, AWS API Gateway and scikit-learn</h3><p>In this tutorial, we deploy a machine learning microservice using AWS Lambda, AWS API Gateway and scikit-learn. The accompanying code repository can be found on <a href="https://github.com/patrick-michelberger/serverless-machine-learning">https://github.com/patrick-michelberger/serverless-machine-learning</a>.</p><p><em>Before you begin, make sure you are running Python 2.7 or Python 3.6 and you have a valid AWS account and your </em><a href="https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs"><em>AWS credentials file</em></a><em> is properly installed.</em></p><h3>Step 1: Train a basic model</h3><p>First, we train a 3-class gradient boosted decision tree logistic regression model on iris data set using the <a href="http://scikit-learn.org/stable/auto_examples/linear_model/plot_iris_logistic.html">scikit-learn tutorial</a> as a guide. Pickle the model as model.pkl.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*HGFgY3qesqtYgBpDz8Ktmg.png" /></figure><p><strong>It doesn’t matter how good this model is</strong> for the purposes of this hack, it just needs to make predictions. Here’s my full model training and serialization script.</p><pre><strong>from </strong>sklearn <strong>import </strong>datasets<br><strong>from </strong>sklearn.ensemble <strong>import </strong>GradientBoostingClassifier<br><strong>from </strong>sklearn.externals <strong>import </strong>joblib</pre><pre># import data<br>iris <strong>= </strong>datasets.load_iris<strong>()</strong></pre><pre>X <strong>= </strong>iris.data<strong>[:</strong>, <strong>:</strong>2<strong>]  </strong># we only take the first two features.<br>Y <strong>= </strong>iris.target</pre><pre># init model<br>clf <strong>= </strong>GradientBoostingClassifier<strong>(</strong>n_estimators<strong>=</strong>100, learning_rate<strong>=</strong>1.0, max_depth<strong>=</strong>2, random_state<strong>=</strong>0<strong>)</strong></pre><pre># fit model<br>clf.fit<strong>(</strong>X, Y<strong>)</strong></pre><pre># save model<br>joblib.dump<strong>(</strong>clf, <strong>&#39;model.pkl&#39;)</strong></pre><h3>Step 2: Upload your model to AWS S3</h3><p>First we have to upload our model to a S3 bucket.</p><pre>aws s3 cp model.pkl s3://yourbucketname</pre><h3>Step 3: Creating a Flask API</h3><p>Let’s create a project directory</p><pre>mkdir serverless-machine-learning<br>cd serverless-machine-learning</pre><p>We wrap all our code and dependencies into a virtual environment.</p><pre>pip install virtualenv<br>virtualenv your_virtual_environment_name<br>source your_virtual_environment_name/bin/activate</pre><p>Now, we’re ready to build our API. Create a directory <em>api</em> with a file called <em>app.py</em> and write this into it:</p><pre>from flask import Flask, request, json<br>import boto3<br>import pickle</pre><pre>BUCKET_NAME = &#39;serverless-machine-learning&#39;<br>MODEL_FILE_NAME = &#39;model.pkl&#39;</pre><pre>app = Flask(__name__)</pre><pre>S3 = boto3.client(&#39;s3&#39;, region_name=&#39;eu-central-1&#39;)</pre><pre>@app.route(&#39;/&#39;, methods=[&#39;POST&#39;])<br>def index():    <br>    # Parse request body for model input <br>    body_dict = request.get_json(silent=True)    <br>    data = body_dict[&#39;data&#39;]     <br>    <br>    # Load model<br>    model = load_model(MODEL_FILE_NAME)</pre><pre># Make prediction <br>    prediction = model.predict(data).tolist()</pre><pre># Respond with prediction result<br>    result = {&#39;prediction&#39;: prediction}    <br>   <br>    return json.dumps(result)</pre><pre>if __name__ == &#39;__main__&#39;:    <br>    # listen on all IPs <br>    app.run(host=&#39;0.0.0.0&#39;)</pre><p>The code is basically self-explanatory. We make a Flask object, use the ‘route’ decorator functions to define our paths, and call a run function when we run it locally (which you can confirm by calling <em>python api/app.py</em> and visiting localhost:5000 in your browser.)</p><p>To load the model from S3 we use the following helper function:</p><pre>def load_model(key):    <br>    # Load model from S3 bucket<br>    response = S3.get_object(Bucket=BUCKET_NAME, Key=key)</pre><pre># Load pickle model<br>    model_str = response[&#39;Body&#39;].read()     <br>    model = pickle.loads(model_str)     <br>    <br>    return model</pre><p>Note: The code in the Github repository uses a memoized annotation to cache the model file after it is pulled from S3, eliminating any need for additional S3 data transfer and leading to significantly faster prediction.</p><h3>Step 4: Configure AWS Lambda &amp; API Gateway</h3><p>We use a framework called Zappa to create and configure both AWS Lambda and the API Gateway automatically. Think of it as “serverless” web hosting for your Python apps.</p><p>That means infinite scaling, zero downtime, zero maintenance — and at a fraction of the cost of your current deployments!</p><p>So let’s start: First, we install the required packages into our virtual environment.</p><pre>pip install zappa sklearn numpy scipy</pre><p>Next, we initialize <a href="https://github.com/Miserlou/Zappa">Zappa</a>.</p><pre>zappa init</pre><p>Zappa has automatically created the a <em>zappa_settings.json</em> configuration file:</p><pre>{ “dev”: <br>    { “app_function”: “api.app.app”, <br>      “aws_region”: “eu-central-1”, <br>      “profile_name”: “default”, <br>      “project_name”: “serverless-machine-learning”, <br>      “runtime”: “python3.6”,<br>      “slim_handler”: true,<br>      &quot;s3_bucket&quot;: &quot;zappa-10z1mxwy2&quot;<br>    }<br>}</pre><p>This defines an environment called ‘dev’ (later, you may want to add ‘staging’ and ‘production’ environments as well), defines the name of the S3 bucket we’ll be deploying to, and points Zappa to a WSGI-compatible function, in this case, our Flask app object.</p><p>By setting the configuration parameter <em>slim_handler</em> to true allows Zappa to load code from Amazon S3 in case our environment exceeds the maximum size of 50 MB.</p><h3>Step 5: Testing the API locally</h3><p>The API can be tested locally like a regular Flask application</p><p>First, run the Flask app as usual:</p><pre>$ python api/app.py</pre><p>Second, make a test API call</p><pre>$ http POST localhost:5000 &lt; paload.json</pre><pre># payload.json<br>{<br>  &quot;data&quot;:[[6.2, 3.4], [6.2, 1]]<br>}</pre><p>The response should be</p><pre>{&quot;prediction&quot;: [2, 1]}</pre><h3>Step 6: Deploying to AWS Lambda</h3><p>Now, we’re ready to deploy to AWS. It’s as simple as:</p><pre>$ zappa deploy dev</pre><p>And our serverless Machine Learning microservice is alive!</p><pre>$ http POST <a href="https://ic06qkgrbc.execute-api.eu-central-1.amazonaws.com/dev">https://ic06qkgrbc.execute-api.eu-central-1.amazonaws.com/dev</a> &lt; payload.json</pre><p>Congratulations, you have finished all required streps to deploy a serverless machine learning microservice. I hope you enjoyed the project.</p><p>Github repository: <a href="https://github.com/patrick-michelberger/serverless-machine-learning">https://github.com/patrick-michelberger/serverless-machine-learning</a></p><p>If you run into issues getting the application working, feel free to DM me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5b8cbead846" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Serverless E-Commerce App with AWS Lambda, Stripe and React]]></title>
            <link>https://medium.com/@patrickmichelberger/building-a-serverless-e-commerce-app-with-aws-lambda-stripe-and-react-4663e241710b?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/4663e241710b</guid>
            <category><![CDATA[e-commerce-solution]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[stripe]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Mon, 21 Aug 2017 13:08:13 GMT</pubDate>
            <atom:updated>2017-08-22T10:31:23.643Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://www.bbc.co.uk/programmes/b006vq92"><em>Dragon’s Den</em></a> (German version, <em>“Die Höhle des Löwen” </em>), a television program featuring entrepreneurs pitching their business idea, offers an amazing opportunity to showcase your products and drive huge awareness to your startup. However, dealing with the enormous influx of traffic during the live broadcast is still a <a href="https://www.facebook.com/yay.digital/videos/919386608166347/">challenging task</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*3vW9bXxg7d7oPAx3k0UlEw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*MoM6PKblEO5hKsC2NPIs4A.png" /><figcaption>Limberly Trachten’s appearance on the GermanDragon’s Den version “Die Höhle des Löwen” and the immediate impact on site traffic.</figcaption></figure><p>In this post, we build a serverless e-commerce app using AWS Lambda, Stripe and React ensuring your website is ready for such traffic peaks. The accompanying code repository can be found on <a href="https://github.com/patrick-michelberger/serverless-shop">https://github.com/patrick-michelberger/serverless-shop</a>.</p><h3>Architecture</h3><p>The bullet-proof, low-cost solution is based on a serverless architecture. Serverless is a hot topic today. A nice introduction by Martin Fowler can be found <a href="https://martinfowler.com/articles/serverless.html">here</a>. There are basically two types of definitions:</p><p>First it can be used to describe applications that significantly or fully depend on 3rd party services in the cloud. These types of services can be described as <strong>“Backend as a Service” (BaaS). </strong>We use <a href="https://stripe.com/de">Stripe</a> as a BaaS provider for both inventory &amp; order management and payments.</p><p>Second, it can also contain some amount of server-side logic but unlike traditional architectures the code is run as plain functions in “stateless compute containers that are event-triggered”. We use <a href="https://aws.amazon.com/de/lambda/">AWS Lambda</a> as a ‘’<strong>Functions as a Service” (FaaS) </strong>provider to communicate securely with Stripe servers and provide a basic Shop API for a web-based Shop Frontend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mzWMk7nh9suMzBGbBx4pBQ.png" /></figure><p>The proposed architecture consists of four components.</p><ol><li><strong>Inventory &amp; Order Management: </strong>Stripe allows to add and receive product and inventory data (product information, sizes, colors, etc.) right from its dashboard or Products API. <a href="https://stripe.com/docs/api#products">https://stripe.com/docs/api#products</a></li><li><strong>Shop API: </strong>To communicate with the Stripe API a secure server environment is still needed. Therefore we use AWS Lambda to execute server functions in the cloud and expose a public Shop API for products and inventory data. AWS Lambda is extremely cheap and we pay only for the time our code runs, and not for hours we rented servers for.</li><li><strong>Payments</strong>: Processing credit cards manually is difficult and dangerous. We use Stripe Checkout as an embeddable payment plugin. Customers can pay instantly, without exposing sensible credit card information to our code. <a href="https://stripe.com/checkout">https://stripe.com/checkout</a></li><li><strong>Shop Frontend: </strong>Instead of building the site on-demand on the server, we entirely host our shop as a static site on a content delivery network (CDN). CDNs offer improved scalability and fast load times by distributing assets globally. The current proof-of-concept site is built with Facebook’s React library.</li></ol><p>In September 2015, Stripe launched <a href="http://www.recode.net/2015/9/14/11618530/stripe-unveils-one-stop-shop-for-buy-buttons-but-will-all-the-social">a new product</a> Relay that allows retailers to sell goods directly in social networking and content apps. Currently, we solely use Relay’s inventory &amp; order management features for our site. In addition to that, the architecture could leverage Relay’s built-in distribution capabilities and effortlessly add additional customer touch points such as social, voice or messenger bots. For more information take a look at the Stripe Relay <a href="https://stripe.com/relay">documentation</a>.</p><h3>III. Implementation</h3><p>Let’s start building. First, we setup the product inventory. Second, we build a Shop API to make our product inventory publicly available. Third, we build the Shop Frontend to showcase our product inventory. Fourth, we include a payment method. Lastly, we send an order from our site to Stripe.</p><h4>Setup the product inventory &amp; order management</h4><ol><li>Signup for a Stripe account on <a href="https://stripe.com/">https://stripe.com</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLiniNobYku-Ml5wFxoyyQ.png" /><figcaption>Stripe dashboard: Products section</figcaption></figure><p>2. Click on “Create your first product” in the dashboard’s products section and fill in some product details (ID, Name, Description, Images)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4D3dQ8Rfl3BoY_PqAvUqZg.png" /><figcaption>Product details view</figcaption></figure><p>3. Add SKUs (Stock Keeping Units) to the created product. Each product can be linked to one or many variants taking into account any combination of attributes (such as color, sizes) and cost. Note: A customer buys a variant of a product (e.g. specific color and size combination), not the product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UFi-u7CtqxzrhAOs5-WpaA.png" /><figcaption>Product variants / Stock Keeping Units (SKUs)</figcaption></figure><p>After this setup, Stripe exposes those products / variants via its <a href="https://stripe.com/docs/api#product_object">Products API </a>.</p><h4>Build the Shop Frontend</h4><p>We use Facebook’s Create React app template to setup an initial site with no build configuration.</p><pre>yarn install -g create-react-app<br><br>create-react-app serverless-shop<br>cd serverless-shop<br>yarn start</pre><p>The example site consists of a basic single product page with product details, a delivery address form, add to basket button and a payment form. The code can be found on <a href="https://github.com/patrick-michelberger/serverless-shop/tree/master/src">github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PbnlBrHdwI0ncK8IQKNd9w.png" /><figcaption>Proof-of-concept Shop Frontend built on React distributed via a CDN provider.</figcaption></figure><p>Please note: This is only a proof-of-concept site, more components such as multiple products, categories etc, can easily be added in the future.</p><h4>Build the Shop API</h4><p>To communicate with the Stripe API a secure server environment is still needed. The secret key can be found in the API section of the <a href="https://dashboard.stripe.com/account/apikeys">Stripe dashboard</a>. We use AWS Lambda to execute server functions in the cloud and expose a public Shop API for products and inventory data.</p><p>To simplify the FaaS setup we use the <a href="https://serverless.com/">Serverless framework</a>.</p><ol><li>Setup the serverless environment</li></ol><pre># Install serverless globally<br>$ npm install serverless -g</pre><pre># Create a separate folder for your serverless code<br>$ mkdir serverless &amp;&amp; cd serverless</pre><pre># Create a serverless function for fetching the products<br>$ serverless create --template fetch-products</pre><p>2. Respond with the fetched products from Stripe.</p><pre>const stripe = require(&#39;stripe&#39;)(process.env.STRIPE_SECRET_KEY); </pre><pre>module.exports.handler = (event, context, callback) =&gt; {  <br>  return stripe.products.list({limit: 10})<br>    .then((products) =&gt; {    <br>      const response = {      <br>        statusCode: 200,      <br>        headers: {        <br>          &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;,      <br>        },      <br>        body: JSON.stringify({        <br>          data: products.data      <br>        }),    <br>      };    <br>      callback(null, response);  <br>});</pre><p>3. Deploy to AWS</p><pre># Deploy to cloud provider<br>$ serverless deploy</pre><pre># Function deployed! Trigger with live url<br>http://xyz.amazonaws.com/fetch-products</pre><p>The Shop Frontend should fetch the products from this endpoint.</p><p>4. Insert the displayed endpoint URL as <em>productsUrl</em> in <em>config.json</em> file</p><pre># Go to frontend folder<br>$ cd src</pre><pre># Copy config.json.example<br>$ cp config.json.example config.json</pre><pre># insert <a href="http://xyz.amazonaws.com/fetch-products">http://xyz.amazonaws.com/fetch-products</a> as productsUrl into # config.json</pre><h4>Setup the Payment methods</h4><p>Finally we use <a href="https://stripe.com/checkout">Stripe Checkout</a> as an embeddable payment plugin.</p><p>1. Insert the Stripe Checkout Javascript library</p><pre>$ cd public</pre><pre># Insert &lt;script src=”https://checkout.stripe.com/checkout.js&quot;&gt;&lt;/script&gt; into the index.html file</pre><p>2. Initialize Stripe Checkout in the <em>componentDidMount()</em> method in the <em>PayButton</em> component.</p><pre>componentDidMount() { <br>  this.handler = window.StripeCheckout.configure({ <br>    key: config.stripe.apiKey, <br>    token: function (token) { self.onToken(token); } <br>  }); <br>}</pre><p>3. Insert the Stripe API’s <a href="https://dashboard.stripe.com/account/apikeys">publishable key</a> as <em>apiKey</em> in <em>config.json</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N21-PY9Rkpz6r2s45iWZcA.png" /><figcaption>Stripe Checkout payment plugin for credit card payments</figcaption></figure><p>After filling out the payment form, Stripe checks the credit card information and returns a token on success. We use the token to create and pay a order for a selected product variant.</p><h4>Extend the Shop API with an order endpoint.</h4><ol><li>Create a serverless checkout function</li></ol><pre># Create a serverless function<br>$ serverless create — template create-charge</pre><p>2. Create an order and pay for it with the received payment token</p><pre>const stripe = require(&#39;stripe&#39;)(process.env.STRIPE_SECRET_KEY);</pre><pre>module.exports.handler = (event, context, callback) =&gt; {  <br>  const requestBody = JSON.parse(event.body);   </pre><pre>  // Payment information (from Stripe Checkout)  <br>  const token = requestBody.token.id;  <br>  const email = requestBody.token.email;   </pre><pre>  // Order information  <br>  const currency = requestBody.order.currency;  <br>  const items = requestBody.order.items;  <br>  const shipping = requestBody.order.shipping;</pre><pre>  // Create order  <br>  return stripe.orders.create({    <br>    currency: currency,    <br>    items: items,    <br>    shipping: shipping,    <br>    email: email  <br>  }).then((order) =&gt; {</pre><pre>    // Pay order with received token (from Stripe Checkout)   <br>    return stripe.orders.pay(order.id, {     <br>      source: token // obtained with Stripe.js    <br>    });<br>    <br>   // Return success info to client (see full code on github)<br>});</pre><p>3. Deploy to AWS</p><pre># Deploy to cloud provider<br>$ serverless deploy</pre><pre># Function deployed! Trigger with live url<br>http://xyz.amazonaws.com/create-charge</pre><p>The Shop Frontend should post the order to this endpoint.</p><p>4. Insert endpoint URL as <em>checkoutUrl </em>in <em>config.json</em> file</p><pre># Go to frontend folder<br>$ cd src</pre><pre># insert <a href="http://xyz.amazonaws.com/fetch-products">http://xyz.amazonaws.com/</a>create-charge as checkoutUrl into # config.json</pre><h3><strong>Run the app &amp; make a test order</strong></h3><p>Finally, the whole site should be working. You can either run the app locally or <a href="https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#firebase">in production</a>.</p><pre># Run the app locall<br>$ yarn start</pre><pre># Deploy the app e.g. via Firebase</pre><pre>$ npm install -g firebase-tools<br>$ firebase login<br>$ firebase init</pre><pre># You will need to agree with database.rules.json being created, choose build as the public directory, and also agree to Configure as a single-page app by replying with y.</pre><pre># Create a production build<br>$ yarn run build</pre><pre># Deploy the app<br>$ firebase deploy</pre><p>Visit the running site. Choose a size, fill in the delivery form, insert a <a href="https://stripe.com/docs/testing">test credit card</a> and click on the pay button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXfkfAPZcrMmmFsIPagPLQ.png" /><figcaption>Orders overview</figcaption></figure><p>After that you should get a success notification and the recent order should be displayed in the products -&gt; orders section of the Stripe dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCLxrZarxkHMOqMhyOXh2Q.png" /><figcaption>Order details view</figcaption></figure><p>Congratulations, you have finished all required streps to build a serverless e-commerce app. I hope you enjoyed the project.</p><p>Github repository: <a href="https://github.com/patrick-michelberger/serverless-shop">https://github.com/patrick-michelberger/serverless-shop</a><br>Demo site: <a href="http://patrick.michelberger.info/serverless-shop/">http://patrick.michelberger.info/serverless-shop/</a></p><p>If you run into issues getting the application working, feel free to DM me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4663e241710b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Anaconda & Docker]]></title>
            <link>https://medium.com/@patrickmichelberger/getting-started-with-anaconda-docker-b50a2c482139?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/b50a2c482139</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[anaconda]]></category>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Mon, 14 Aug 2017 10:03:23 GMT</pubDate>
            <atom:updated>2017-08-14T10:42:39.611Z</atom:updated>
            <content:encoded><![CDATA[<p>In the following post, I’d like to document how to setup Anaconda and Docker to quickly reproduce data science environments across different platforms and collaborators.</p><h3>Big picture</h3><p>Anaconda with its sandboxed environment for scientific python packages and Docker’s containerization technology make a great combination for scalable, reproducible and portable data science deployments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6hwa_vJ-4RY6uNq9Z77KQ.png" /></figure><p>You can use Anaconda with Docker to build, containerize and share your data science applications with your team. Collaborative data science workflows with Anaconda and Docker make the transition from development to deployment as easy as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aE-GnjG8O5z46vwOFMNGg.png" /></figure><p>Finally, containerizing the data science application enables the use of container clustering systems such as Kubernetes to scale the application in production.</p><h3><strong>Basic workflow</strong></h3><ol><li>Choose one of the Anaconda images based on your project requirements <a href="https://hub.docker.com/u/continuumio/">https://hub.docker.com/u/continuumio/</a></li><li>Pull the chosen image</li></ol><pre>$ docker pull continuumio/anaconda3</pre><p>3. Run the image and start an interactive shell</p><pre>$ docker run -i -t continuumio/anaconda3 /bin/bash</pre><p>4. Once the Docker container is running, we can start an interactive Python shell, install additional conda packages or run Python applications.</p><h3>Example: Jupyter Notebook</h3><ol><li>Start Jupyter Notebook server with Anaconda from a Docker image</li></ol><pre>$ docker run -i -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c “/opt/conda/bin/conda install jupyter -y — quiet &amp;&amp; mkdir /opt/notebooks &amp;&amp; /opt/conda/bin/jupyter notebook — notebook-dir=/opt/notebooks — ip=’*’ — port=8888 — no-browser”</pre><p>2. Open <a href="http://localhost:8888/">http://localhost:8888</a> to view Jupyter notebook</p><h3>Recap: Docker commands</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_9c9ttl-09eSKoSazPnNQ.png" /><figcaption><a href="https://docs.docker.com/get-started/part2/#recap-and-cheat-sheet-optional">https://docs.docker.com/get-started/part2/#recap-and-cheat-sheet-optional</a></figcaption></figure><p>Source: https://www.continuum.io/blog/developer-blog/anaconda-and-docker-better-together-reproducible-data-science</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b50a2c482139" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trackly: Catch an open thesis topic in an automatic way.]]></title>
            <link>https://medium.com/@patrickmichelberger/trackly-catch-an-open-thesis-topic-in-an-automatic-way-9c346e6ab696?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c346e6ab696</guid>
            <category><![CDATA[thesis]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[tracking]]></category>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Mon, 14 Aug 2017 09:09:20 GMT</pubDate>
            <atom:updated>2017-08-14T09:15:39.506Z</atom:updated>
            <content:encoded><![CDATA[<p>In search of a Master’s thesis topic, I faced the problem of regularly checking different chair websites for open research topics.</p><p>After some days visiting the set of pages manually, I discovered a convenient service called <a href="https://trackly.io/">https://trackly.io</a>. It tracks web pages and tells you when they change.</p><p>The procedure is as follows:</p><ol><li>Signup for free on <a href="https://trackly.io/">https://trackly.io</a></li><li>Choose the webpages you like to track (e.g. <a href="https://www.cm.in.tum.de/en/theses/">https://www.cm.in.tum.de/en/theses/</a>)</li><li>Trackly checks the websites every hour 24/7 for free.</li><li>If a change is detected you’ll receive an email with the changes highlighted.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUc6l-zEBlGnWh0ao6w7aA.jpeg" /></figure><p>Currently tackly.io is in beta and free of charge. If in the near future the pricing model changes, there is also a nice image comparison tool from Yahoo available to reengineer the service <a href="https://github.com/yahoo/blink-diff">https://github.com/yahoo/blink-diff</a>.</p><p>If you know a similar or even better service for tracking website changes, feel free to leave a comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c346e6ab696" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thing Translator: My Italian language assistant]]></title>
            <link>https://medium.com/@patrickmichelberger/thing-translator-my-italian-language-assistant-7b1588897d72?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b1588897d72</guid>
            <category><![CDATA[translators]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Sun, 13 Aug 2017 14:53:36 GMT</pubDate>
            <atom:updated>2017-08-13T14:53:36.112Z</atom:updated>
            <content:encoded><![CDATA[<p>For my time in beautiful Milan I built a little language assistant to improve my Italian skills in the next 6 months. It lets you take a picture of something to hear how to say it in Italian. It’s just one example of what you can make using Google’s machine learning API’s, without needing to dive into the details of machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*NwUMD7ZncveQ9Lz-xVueDQ.png" /></figure><p>The current code can be found here <a href="https://github.com/patrick-michelberger/babel">https://github.com/patrick-michelberger/babel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b1588897d72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building An E-Commerce App With Node.js & The ABOUT YOU API (2/3)]]></title>
            <link>https://medium.com/@patrickmichelberger/building-an-e-commerce-app-with-node-js-the-about-you-api-2-3-f3b7447064da?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b7447064da</guid>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Mon, 15 Dec 2014 15:48:27 GMT</pubDate>
            <atom:updated>2014-12-17T23:01:10.088Z</atom:updated>
            <content:encoded><![CDATA[<p>Having done the setup of our application in the <a href="https://medium.com/@patrickmichelberger/building-an-e-commerce-app-with-node-js-the-about-you-api-85b771465ed3">first part of this tutorial</a><br>we are going to concentrate on setting up the ABOUT YOU SDK in the following part of the tutorial.</p><h3>Part II: ABOUT YOU SDK</h3><p>We’re going to setup the two needed API calls to fetch you app’s categories and to execute an arbitrary product search in the following section.</p><h4>Packages</h4><p>To get going we install the SDK via npm</p><pre>npm install aboutyou-sdk --save</pre><p>Using the option —save automatically adds the module to the dependency section of our package.json file</p><pre>“aboutyou-sdk”: “^0.1.0&quot;</pre><p>Your version is probably newer than 0.1.0 — it’s just the current one available right now.</p><h4>Credentials</h4><p>The use of the ABOUT YOU API requires credentials that you obtain on developer.aboutyou.de</p><p>To do so, create a new application and take a look on the overview page. There you can find your App-ID and credentials (token &amp; secret).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PzhFtSAXlNo68a-bGfSZgQ.png" /><figcaption>On the overview page you can find your app’s credentials (App-ID &amp; Token)</figcaption></figure><p>For the sake of convenience we’re going to use the test credentials that allow us to access a sample’s app category &amp; product catalogue.</p><h4>Setting up the configuration</h4><p>We need to add the ABOUT YOU SDK to our app.js file and initialize it with our sample App-ID and token.</p><p>For the sake of convenience, we intercept each http request and bind the ay object to the req parameter.</p><pre>var aboutYou = <br>require(&#39;aboutyou-sdk&#39;)(100,&#39;3ed93394c2b5ebd12c104b177b928ad0&#39;);</pre><pre>// Make the AboutYou module accessible to our router<br>app.use(function(req,res,next){ <br>  req.aboutYou = aboutYou;<br>  next();<br>});</pre><p>Having made these changes the SDK is now accessible to all of our app’s routes and we’re finally ready to start our categories &amp; products integration.</p><h4>Fetching your app’s category tree</h4><p>A category is a simple JSON object that looks like this</p><pre>{<br>  &quot;id&quot;: 74415,<br>  &quot;name&quot;: &quot;Frauen&quot;,<br>  &quot;active&quot;: true,<br>  &quot;subcategories&quot;: [{<br>    &quot;id&quot;: 74417,<br>    &quot;name&quot;: &#39;Shirts&#39;,<br>    &quot;active&quot;: true,<br>    &quot;subcategories&quot;: []<br>  }]<br>}</pre><p>Categories are basically a defined product filter. You use them to decide which of the more than 50.000 ABOUT YOU products should be offered in your app. Lastly, they are also used as a navigation tool through your app.</p><p>You can create &amp; configure them in the Developer Center:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eGXosh7rf5PP1Yrh4AiL-w.png" /><figcaption>Create &amp; configure your app’s categories on developer.aboutyou.de</figcaption></figure><p>Once you finished your categories settings you can query them through our SDK method <strong>fetchCategoryTree()</strong>.<br>To make your category tree accessible via an API call we’ll extend index.js with a <strong>/api/categories </strong>route:</p><pre>var express = require(&#39;express&#39;);<br>var router = express.Router();</pre><pre>var ay = <br>require(&#39;aboutyou-sdk&#39;)(100,&#39;3ed93394c2b5ebd12c104b177b928ad0&#39;);</pre><pre>/* GET home page. */<br>router.get(&#39;/&#39;, function(req, res) {<br> res.render(&#39;index&#39;, { title: &#39;Express&#39; });<br>});</pre><pre>/* API */<br>router.get(&#39;<strong>/api/categories&#39;</strong>, function(req, res) {<br> req.aboutYou.<strong>fetchCategoryTree</strong>(function(error, categoryTree) {<br>   var categories = categoryTree.toJSON();<br>   res.json(categories);<br> });<br><strong>});</strong></pre><pre>module.exports = router;</pre><p>When running your app now using npm start, you should be able to navigate over to <a href="http://localhost:3000/api/categories"><strong>http://localhost:3000/api/categories</strong></a> and should return your app’s category tree.</p><h4>Executing a product search</h4><p>This was quite straightforward and you’ve got now all data to build a basic category navigation. Anyway, the real fun starts when we are able to display the actual products.<br>A product is a simple JSON object that can look like this:</p><pre>{<br>  “id”: 1580329,<br>  “name”: “T-Shirt aus Jersey”,<br>  “brand”: {<br>    “id”: 414,<br>    “name”: “EDC BY ESPRIT”<br>  },<br>  “defaultImage”: {<br>    “url”:     “<a href="http://cdn.aboutyou.de/file/ed4745ab6847f37ec11acbf9a6002e5b">http://cdn.aboutyou.de/file/ed4745ab6847f37ec11acbf9a6002e5b</a>&quot;<br>  }<br>}</pre><p>To get this data, we need again a new route in our application and we’re going to leverage the SDK method <strong>fetchProductSearch(</strong>criteria, callback).</p><pre>router.get(&#39;/api/categories/:id/products&#39;, function(req, res) {<br>  var <strong>criteria</strong> = req.aboutYou.productSearchCriteria;<br> <br>  // search criteria settings<br>  criteria.<strong>filterByCategoryIds</strong>(req.params.id);<br>  criteria.<strong>selectProductFields</strong>([&#39;brand_id&#39;, &#39;default_image&#39;]);</pre><pre>  // execute product search <br>  req.aboutYou.<strong>fetchProductSearch</strong>(criteria, function(err, searchResult) {<br>    if(!err) {<br>      var products = searchResult.toJSON();<br>      res.json(products);<br>    }<br>  });<br>});</pre><p>There are various setting options for the search criteria: An overview of the available methods can you find in the <a href="https://developer.aboutyou.de/doc/products#produktsuche-durchfuhren">documentation</a>.</p><h4>Part 3</h4><p>Congratulations, our application delivers category &amp; product data successfully but doesn’t use any UI yet. In the last part (released very soon) of this tutorial I’m going to focus on the front-end and the interaction with our existing code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b7447064da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building An E-Commerce App With Node.js & The ABOUT YOU API (1/3)]]></title>
            <link>https://medium.com/@patrickmichelberger/building-an-e-commerce-app-with-node-js-the-about-you-api-85b771465ed3?source=rss-d9b3a7de1139------2</link>
            <guid isPermaLink="false">https://medium.com/p/85b771465ed3</guid>
            <dc:creator><![CDATA[Patrick Michelberger]]></dc:creator>
            <pubDate>Sun, 14 Dec 2014 20:13:17 GMT</pubDate>
            <atom:updated>2014-12-17T08:23:03.442Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><a href="http://www.aboutyou.de/">ABOUT YOU</a> is a new fashion online shop with more than 55.000 products and offers an outstanding developer <a href="http://developer.aboutyou.de/">platform</a> to create your own E-commerce app.<br>You write the code to build the showcase, ABOUT YOU manages the whole backend, payment &amp; fulfillment process.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oqu-8sEwvDuqQpTeYco5Kw.png" /><figcaption>There are already a bunch of apps showcased on aboutyou.de</figcaption></figure><p>This is going to be a tutorial which consists of three parts:<br>Initial setup, using the ABOUT YOU SDK for Node.js and creating an UI with a shopping basket.</p><h3>Part I: Initial setup</h3><p>For the first part of this tutorial I show you the inital setup &amp; required packages to build our Node.js web app.</p><h4>Packages</h4><p>Our application uses the Express framework which can be considered the de facto standard for Node.js development.</p><p>I assume that you’ve got the node &amp; npm executables setup already.</p><h4>Installing Express</h4><p>To install Express globally use the following command</p><pre>npm install -g express</pre><p>After that we’re going to create a new folder and use Express to setup a default Node.js project.</p><pre>mkdir testapp<br>cd testapp<br>express --hbs<br>npm install</pre><p><strong>app.js </strong>is basically the skeleton of your application and is mainly responsible for bootstrapping your application.<br><strong>package.json</strong><em> </em>contains all requirements and should look something like this:</p><pre>{<br>  &quot;name&quot;: &quot;testapp&quot;,<br>  &quot;version&quot;: &quot;0.0.0&quot;,<br>  &quot;private&quot;: true,<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node ./bin/www&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;express&quot;: &quot;~4.9.0&quot;,<br>    &quot;body-parser&quot;: &quot;~1.8.1&quot;,<br>    &quot;cookie-parser&quot;: &quot;~1.3.3&quot;,<br>    &quot;morgan&quot;: “~1.3.0&quot;,<br>    &quot;serve-favicon&quot;: &quot;~2.1.3&quot;,<br>    &quot;debug&quot;: &quot;~2.0.0&quot;,<br>    &quot;hbs&quot;: &quot;~2.7.0&quot;<br>  }<br>}</pre><p>Next to Express we defined <strong>handlebars </strong>for rendering our server-side templates.</p><p>In your <strong>app.js</strong> we can get rid of the following lines.</p><pre>var users = require(‘./routes/users’);<br>app.use(&#39;/users&#39;, users);</pre><p>Also delete <em>/routes/users.js</em> as we are not going to need it for the project.</p><p>In this tutorial most of the implementation is going to happen in routes/index.js. This is the place where we define the functions to be executed when our application receives HTTP requests.</p><p>You can run the project by executing</p><pre>npm start</pre><p>in your project’s root folder and navigate to <a href="http://localhost:3000."><strong>http://localhost:3000</strong>.</a> Please note,<strong> npm start </strong>is an alias for <strong>node ./bin/www</strong> defined in the package.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Nr4CbBUkZQXfCOf9hItBA.png" /><figcaption>Visit your initial application via http://localhost:3000</figcaption></figure><p>Congratulations, we have finished all the required setup and we can now concentrate on the ABOUT YOU SDK integration <a href="https://medium.com/@patrickmichelberger/building-an-e-commerce-app-with-node-js-the-about-you-api-2-3-f3b7447064da">in the next part of this tutorial.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85b771465ed3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>