<?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 Mireille Bobbert on Medium]]></title>
        <description><![CDATA[Stories by Mireille Bobbert on Medium]]></description>
        <link>https://medium.com/@mireillebobbert?source=rss-9dfdae75ea54------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S9qqlZWYbYyOKiw9dT6gIg.jpeg</url>
            <title>Stories by Mireille Bobbert on Medium</title>
            <link>https://medium.com/@mireillebobbert?source=rss-9dfdae75ea54------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:28:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mireillebobbert/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 I used Midjourney v4 + ChatGPT-4 to create a kids book within 5 hours]]></title>
            <link>https://mireillebobbert.medium.com/how-i-used-midjourney-chatgpt-to-create-a-kids-book-within-5-hours-895a5f40c285?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/895a5f40c285</guid>
            <category><![CDATA[chatgpt4]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning-ai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[midjourney]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 14:00:14 GMT</pubDate>
            <atom:updated>2026-11-10T09:37:42.079Z</atom:updated>
            <content:encoded><![CDATA[<p>My nephew loves Paw Patrol. He asks anyone to read the same Paw Patrol story over and over again. So, I thought, wouldn’t it be a mind blowingly cool idea to create a Paw Patrol story with familiar characters as the protagonists?</p><p>This thought came up last Summer (of ‘22), when I thought of a gift for my nephew’s upcoming birthday. Earlier, I had <a href="https://www.mireillebobbert.com/2020/05/02/pws6-the-kids-book-that-could-differentiate-itself-in-the-kids-book-jungle-potential-success-on-hold/">created various kids books for him with Paint</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-h-iAfWvadt4DWPaHUN2pA.jpeg" /><figcaption>How I used Paint to create my first kids book. Source: mireillebobbert.com</figcaption></figure><p>I loved the process but didn’t want to use Paint again as it would take me forever to create the Paw Patrol pups one by one. I then thought of using Canva, that provided a nice alternative creating a book using icons. Earlier I had used it to launch my kids book as an e-book with different versions on <a href="https://www.amazon.nl/dp/B0BCZ7F23S">Amazon NL</a>, <a href="https://www.amazon.co.uk/dp/B0BFNJK6CZ">Amazon US</a> and <a href="https://www.amazon.co.uk/dp/B0BFNJK6CZ">Amazon UK</a> ( it never made a dime).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rAA8ahac-XR1upoa" /><figcaption>Canva cover kids book available on Amazon UK</figcaption></figure><p>But that too, would take too long. So I abandoned the idea and got him another gift.</p><p>Fast forward a few months and everyone starts talking about Midjourney. It is supposedly this amazing image generation tool that creates super high quality images. I decided to give it a go and see what it would generate. The results blew my mind.</p><p>Here’s how I created my kids book within a couple of hours.</p><p>The main goal was to create a funny Paw Patrol story to see how different AI tools could help me produce this book fast. So I asked ChatGPT for storyline input:</p><h4>Step 1. Use ChatGPT to create a storyline fast</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*deQbFJylGwprpAy-etlPyg.png" /><figcaption>“I’d like to create a kids book for my 3-year old nephew who loves Paw Patrol. Create a story line of 12 pages with a rhyme of max 4 sentences per page. The story is about aunt Mireille who is rescued from the forest because she is lost.</figcaption></figure><p>To tweak it further, I asked ChatGPT to create a normal story rather than a rhyme, and to turn it into present tense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*9ECOS_tTc15g-iq4EtElvg.png" /><figcaption>A snapshot of ChatGPT’s storyline per page</figcaption></figure><p>With this input, I could use my imagination to structure the images.</p><h4>Step 2. Use Midjourney to generate the images for the kids book</h4><p>After some research on how to use Midjourney (You have to download Discord, a chatbot that Midjourney uses to generate images based on your input, and then work from there, rather than from Midjourney’s website), I was up and running with the ‘/imagine’ prompt. I kept these two Midjourney Quick Start pages open during my image generations:</p><ul><li><a href="https://docs.midjourney.com/docs/prompts">Midjourney Prompts</a></li><li><a href="https://docs.midjourney.com/docs/explore-prompting">Midjourney Explore Prompting</a></li></ul><p>To get into the flow, my first prompt was a generic Paw Patrol prompt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*KNBgWofYVRJx0KKVt5L_5A.png" /><figcaption>First Midjourney prompt</figcaption></figure><p>As the goal was to use myself as the Paw Patrol victim to rescue, I wanted to see what effect Midjourney could have on turning a specific emotion of a picture into a different one.</p><p>Note: whenever I refer to “[image web url]” below, I refer to a URL of my website’s media library that hosts my media. Midjourney requires image urls as input if you want to use an image as input for prompts.</p><p>Prompt: “/imagine [image web url] girl in picture looks sad” , using the image from my website below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HoTUriA8MXKazGEx.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*sv4ri-0szXeQygQ8P9rPzA.png" /><figcaption>Generated sad girl image from happy girl photo input</figcaption></figure><p>I was pretty mind blown. The generated girl actually looked like me. And she looked relatively sad, as requested.</p><p>Now it was time to start image generation for my book.</p><p>My first kids book prompt had to involve an image of me, in combination with a Paw Patrol reference:</p><p>Prompt: “/imagine [web image url] place this girl in a paw patrol setting with green grass”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*KEkcQppoXsetSDDEBWuwyg.png" /><figcaption>First generated image of me as a Paw Patrol character</figcaption></figure><p>Really not bad, I was looking at myself as a Paw Patrol figure, especially image 2 (top right), looked pretty amazing!</p><p>Then I wanted to see how the image would change if I referred to Ryder, the only main character that is not a pup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*sbZeZErlPXP8KPN3xEdnbw.png" /><figcaption>Prompt: “/imagine [web image url] make this girl look like ryder from paw patrol with green grass in background”</figcaption></figure><p>Holy shit! The girls look even better than in my previous prompt! The first image I pick is image 3 (left below).</p><p>As at one point in my story I am in trouble, I needed a sad looking picture of me in Paw Patrol setting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*piQlbUtpj2UIs0FYg3OIJQ.png" /><figcaption>Prompt: “/imagine [web image url] girl looks sad in boat in paw patrol setting”</figcaption></figure><p>I choose image 1 as it most resembles the girl I picked earlier.</p><p>Then it was time for the next level: I wanted to put some images together for the actual Paw Patrol shot with Ryder. I used these two images with the BLEND prompt. The blend prompt allows you to blend 2 images (up to 5 I believe). You can’t add any further instruction when using this prompt. At least not at the time of writing this (using version 4).</p><p>Prompt: “/blend [web image url 1][web image url 2]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Omo-GW_h9vDrTShk.png" /><figcaption>Web image 1. Source: unknown</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*zrhxCzqgvXKV75XN.jpeg" /><figcaption>Web image 2. Source: unknown</figcaption></figure><p>The result was this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*jJxu1ZycKmKoIYFlgDBxeg.png" /><figcaption>Result “/blend” command with 2 image URLs</figcaption></figure><p>Not entirely what I wanted, as it was not my goal to turn Ryder into a pup, but rather to add Ryder to the image with the pups. I hence discovered the first limitation of Midjourney, but hey, you can’t have it all.</p><p>Some more trials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*mqiJj2dR6uX9Eun3AnLpwA.png" /><figcaption>Prompt: “/imagine paw patrol pups and ryder ready for action”. I like image 3 but Ryder looks scared rather than excited.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Z801d-ZPnPYWXN-GIT7KaA.png" /><figcaption>The generated characters don’t express the emotion I am looking for</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*ORDfAqRAhV1Og4DuQkiu2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDxqErhQi7dhdgLC7EOprg.png" /></figure><p>In the end I decided to go for this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*Ku61P_fS9txjOrOB8nOhTg.png" /></figure><p>I was then looking for a shot of Skye (one of the pups who owns a helicopter) looking at my boat from a bird eye view. I again tried the ‘blend’ command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/0*ES3WxFi3Dcz7QUQK.jpeg" /><figcaption>Web image 1. Source: unknown</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*W4M0gV3Px_wB4GP9.jpeg" /><figcaption>Web image 2. Source: unknown</figcaption></figure><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*e4y7ClapuNufiy1eEZi-5A.png" /><figcaption>Result of Blend command prompt.</figcaption></figure><p>Again, rather than adding the two pictures together, it really blended them, which I guess is what the command is for. The command just doesn’t work as how I had imagined it.</p><p>Instead I used a basic text prompt to generate an image of Skye looking for me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*B-CwPnyD3z0jJlx8WURAjg.png" /><figcaption>I went for image 4 as it best resembles Skye using her helicopter</figcaption></figure><p>Continuing, I needed an image of me being excited to know the pups will rescue me, again with a ‘blend’ prompt. I started with these images:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BtxXnykeYC-5Nasm.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/0*bnF1OFQWQFs-3Rz_.png" /></figure><p>The result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*R85meyvwRM8DU7XnQo2EfA.png" /><figcaption>Prompt: “/blend [web image 1] [web image 2]”</figcaption></figure><p>Not what I wanted. Another few iterations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*VCLjpz_VBFFvpqLcWWz_nw.png" /><figcaption>Prompt: “/imagine [web image url] girl on boat paw patrol — aspect 4:3”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*jXRV_xxGzJqn_N6sDDTBNg.png" /><figcaption>Prompt: “/imagine [web image url] girl on boat paw patrol setting cartoon white uniform — — no trees”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*6FXYK7DuiUsJbqLPKvnnGA.png" /><figcaption>Prompt: “/imagine [web image url] girl on boat paw patrol “</figcaption></figure><p>In the end I gave up and picked image 2 of last prompt, as she looked most like the other generated girls.</p><p>Once I am rescued, I wanted to show an image of me in Zuma’s rescue boat, and used ‘blend’ again. Again, without luck. Here are my 2 input images, the goal: me in Zuma’s boat, with Zuma also on the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/0*T1UZt5Ihp4LLO17I.png" /><figcaption>Image 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*as6df95cKP22yMde.png" /><figcaption>Image 2</figcaption></figure><p>Result: Instead of combining me and Zuma and the boat, I was turned into a pup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*dEvdgjYj5CHwuWI-t2v8tA.png" /><figcaption>Prompt: “/blend [web image 1][web image 2]”</figcaption></figure><p>So I went for the alternative image prompt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n7UW8vhuKC7DAn08.jpg" /><figcaption>Input image</figcaption></figure><p>Prompt: “/imagine [web image url] in resuce boat with zuma paw patrol setting.</p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*rudmGe2a8O-eSyKlzkdIeQ.png" /><figcaption>Prompt: “/imagine [web image url] in rescue boat with zuma paw patrol ssetting”</figcaption></figure><p>Pretty neat. I chose image 2.</p><p>As the final celebration image of me arriving safe and sound back home, I wanted an image of everyone celebrating. It wasn’t straightforward:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*wtWGMEYEq21sMOmP8OvOtg.png" /><figcaption>Prompt: “/imagine paw patrol team is very happy paw patrol setting”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*lK1JhmNBGDht_gccqai8fg.png" /><figcaption>Prompt: “/imagine paw patrol receives new emergency paw patrol setting balloons party cake confetti”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*8XpMrImsfPFt7fAc-DFgfw.png" /><figcaption>Prompt: “/imagine paw patrol setting party balloons paw patrol team”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*Ozsvl4WGcUkkeV6Gp39u0Q.png" /><figcaption>Prompt: “/imagine paw patrol setting cartoon party balloons paw patrol team”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*80xvL1Jd9q_wskYfWxUfmA.png" /><figcaption>Prompt: “/imagine paw patrol setting cartoon party balloons paw patrol team”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*Fc6KS8MXonWUm9ueZjUdjg.png" /><figcaption>Prompt: “/imagine paw patrol cartoon party balloons paw patrol team happy ryder chase skye zuma”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*YYwuKWRHquC9SRoxlrOR6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*u1aJ-2s3MVclOCfiwauE-w.png" /></figure><p>I gave up and changed the storyline to fit to an earlier generated image.</p><h4><strong>Step 3: Create the image + storyline overview with Canva</strong></h4><p>I used Canva to create the overview of all the images and the storyline per page, so that I knew which image to paste where in the final book.</p><h4>Step 4. Use any photobook tool to create the final book + print it</h4><p>I usually use Albelli to create my kids books, but I found it an expensive option for the experiment I was undertaking (easily 40 euros per book ex shipping fees). So I ended up using HEMA Photoservice that offers a small photo book for only 9 euros. The idea was not to be fancy, but rather to offer this book to my nephew as a cool and funny gift.</p><p>Here is part of the book, generated via Canva:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.canva.com%2Fdesign%2FDAHagf7Vr9s%2F663zDFqF4GMA2cPjfeTEHQ%2Fview%3Fembed%26meta&amp;display_name=Canva&amp;url=https%3A%2F%2Fwww.canva.com%2Fdesign%2FDAHagf7Vr9s%2F663zDFqF4GMA2cPjfeTEHQ%2Fview&amp;image=https%3A%2F%2Fwww.canva.com%2Fdesign%2FDAHagf7Vr9s%2F663zDFqF4GMA2cPjfeTEHQ%2Fscreen%3Ftype%3Dthumbnail&amp;type=text%2Fhtml&amp;schema=canva" width="1080" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/90b1ad8bc8a3e89bf5893de94e0f0af4/href">https://medium.com/media/90b1ad8bc8a3e89bf5893de94e0f0af4/href</a></iframe><h4>Conclusion</h4><p>I’m blown away by the speed and quality with which we can create images with Midjourney v4. Anyone can create a kids book within hours and print it or sell it on Amazon with Kindle Direct Publishing (or use the images for plenty of other types of projects).</p><p>Even though I miss a ‘combine’ function in Midjourney, I’m extremely impressed with the available options to create the images of your dreams, and I’m sure it won’t be long before we can actually combine pictures.</p><p>And how cool to create a cartoon version of yourself via AI?!</p><p>One thing I immediately noticed is that my cartoon version looks amazing. Look at this image in particular:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*as6df95cKP22yMde.png" /></figure><p>Simply crazy.</p><p>Conclusion: I highly recommend using Midjourney for a fun experimental project!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=895a5f40c285" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Wiki Saga — an ERIKS adventure]]></title>
            <link>https://mireillebobbert.medium.com/the-wiki-saga-an-eriks-adventure-e67a21b50c3b?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/e67a21b50c3b</guid>
            <category><![CDATA[graphic-design]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[innovation]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 19:11:01 GMT</pubDate>
            <atom:updated>2022-11-11T05:53:47.328Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Wiki Saga — an ERIKS adventure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Dj5nLLRN9SpIExSI6TZew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_RogkH9s2pHW33BbLPHy2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upLIvvahEzZ4O_IypNaCNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQPUWhbx20Gv8eVC6xPIKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bo72TT79IFr391DNZh5Q-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5zN2mz9DgtfskRG1SWnPUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIbkAgKRtLKjIsXjnTmJPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRPJV1x0prUZp0izyVe2Og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQpCKneo_vKXkAqR8ETFzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j563SXkNQiXdU8-XIAkXzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AH65NfScK5qqFHiMj12jWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cgy6DarL7pT3kmlY0QMuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NEVK4VCVSywg3F1XEXn4Qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3Ra9bvtVAbLwaIEBlV3Ug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IqZUW16TflFRzc6stru8JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRPNCx5VLWlBrL-M24jRcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*30qTIenMzEG9v_9wlwuGFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8OztJw8VmXmau0hc4AFUcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-GXjYBRHCss8q6qFrQsHgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1bkYgA36r6DR03B6m15SNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SDuspUKH8VGQQD3JeThJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThVDmAty1Q9HXNmV0wlR6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hlhi0qHSpGqN-PJvTjBM8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*skcaMV3mXDqFnXPl2SHEeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlsSWwSd2lu65yn_7n4gVw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e67a21b50c3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The business learns NLP (Part 3): Word embeddings, or, how to represent words as vectors]]></title>
            <link>https://mireillebobbert.medium.com/the-business-learns-nlp-part-3-word-embeddings-or-how-to-represent-words-as-vectors-ba42f2f58d4b?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba42f2f58d4b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[cartoon]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Wed, 15 Jul 2020 15:13:06 GMT</pubDate>
            <atom:updated>2020-07-16T09:48:50.465Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2JJtbh9cmHjxzqp0opGhEA.png" /></figure><p>It’s time for a new lesson on NLP! Last week during <a href="https://medium.com/@mireillebobbert/the-business-learns-nlp-part-2-twitter-sentiment-analysis-with-naive-bayes-dd5f6f69e787">part 2 of deeplearning.ai’s specialization on NLP </a>we learned how to perform Twitter sentiment analysis with Naive Bayes, this week we learn more on word embeddings. Key takeaway: if you capture the meaning of a word in numbers, a whole new world opens up…;-)! Enjoy!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1cpDlTVEaJ0mS1O0uFzO3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0P4mZvrfh-wEX5qjCbnsCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DN-QfMsJ0IUwOfPHZvQ5lA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZXXnWHQRW8Tz_HEORucPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*efx-UeG4doXpxDSy1p8mjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QK-qtLOARIu_VTXFwJTG2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hT5IgfsmiasgR4X3qtOs4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHybXr8qlhj_-4l3bOkkYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eowv7gOw2Q--wdlWhPztaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GA06nDt3U9yxZczz3Itv3g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba42f2f58d4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The business learns NLP (part 2): Twitter sentiment analysis with Naive Bayes]]></title>
            <link>https://mireillebobbert.medium.com/the-business-learns-nlp-part-2-twitter-sentiment-analysis-with-naive-bayes-dd5f6f69e787?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd5f6f69e787</guid>
            <category><![CDATA[cartoon]]></category>
            <category><![CDATA[twitter]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[naive-bayes]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Wed, 08 Jul 2020 17:15:31 GMT</pubDate>
            <atom:updated>2020-07-09T05:37:58.838Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eeezPVDDs_MDO-moUOQ2zg.png" /></figure><p>Last week (<a href="https://medium.com/@mireillebobbert/the-business-learns-nlp-part-1-twitter-sentiment-analysis-with-logistic-regression-cb899fbab1e3">The business learns NLP — Part 1</a>) we learned how to do sentiment analysis with logistic regression. This week we will try a different technique: Naive Bayes!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmXWIiNbj-cDKRFhS8KBKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hRd2ZVTusfGE6lBxMYPYPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OiVhgUkt5hQd5nWHO3b8pw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwBVoNgmAo7DxZ7g4In3yA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGpPvprH46pky_cHJvG9sA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GIKd86Tj2V_Llw5U0uSspQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*12H06o1u_YKz8E7xcoNGXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9biSvO3Z0om38im3M2Jy2w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd5f6f69e787" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The business learns NLP (part 1): Twitter sentiment analysis with logistic regression]]></title>
            <link>https://mireillebobbert.medium.com/the-business-learns-nlp-part-1-twitter-sentiment-analysis-with-logistic-regression-cb899fbab1e3?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb899fbab1e3</guid>
            <category><![CDATA[deeplearningai]]></category>
            <category><![CDATA[cartoon]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Sun, 28 Jun 2020 09:07:45 GMT</pubDate>
            <atom:updated>2020-07-08T17:19:39.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gSauzRJsq_WNw_3KRS2FhQ.png" /></figure><p>Today we will discuss predicting the sentiment of a tweet with logistic regression. The main lesson is that rather than using all the words in your bag of words as separate features to predict a tweet’s sentiment, you can downsize the number of features to only 3 features per tweet, and make highly accurate predictions!</p><p>For a detailed explanation of logistic regression, check my <a href="https://medium.com/@mireillebobbert/imagine-logistic-regression-as-a-hungry-snake-predicting-whether-an-object-in-his-vicinity-is-3f43f13e5a7a">earlier blogpost</a>.</p><p>This is a recap from <a href="https://coursera.org/share/445a804d9d49c2c5196dd5c91393b7df">Deeplearning.ai’s NLP specialization Course 1</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y8gI-AsqBIsziw0NJ8rJwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaTP2SQn_FzII-alvBA1sQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QnQ758WuqTyK2Vc2h4coQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvm5wuQpapivEJwo9U8j6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XFvpiYXZ-UGOZ55uHgUpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AkB921xMC55PEtgcJWCaEg.png" /></figure><p>This article is part of a series. Continue with <a href="https://medium.com/@mireillebobbert/the-business-learns-nlp-part-2-twitter-sentiment-analysis-with-naive-bayes-dd5f6f69e787">The Business Learns NLP — Part 2: sentiment analysis with Naive Bayes</a>.</p><h3><strong>Nitty gritty notes for those who want to get to the bottom of it:</strong></h3><p>Note that logistic regression is part of supervised learning, hence we will use the sentiment labels of our training set (real ys) to train our model.</p><h4>Step 1. Prep your data as input for your model</h4><ul><li><strong>Step A First things first, we will create a train set and a test set</strong>, so that we can evaluate how well our models generalizes to new data</li><li><strong>Step B Process your tweets</strong> (def process_tweet(tweet)) → all about cleaning up your tweets and make them nice and tidy to work with!</li><li><strong><em>Input</em></strong>: a tweet</li><li>Clean up the dirt: Look at each tweet, remove hashtags, hyperlinks, retweets, handles</li><li>Once dirt is removed, cut each tweet up in separate words, this is called tokenization, and create a variable (tweet_tokens)</li><li>Create an empty array in which to store all the cleaned up words (tweets_clean)</li><li>For every word in tweet_tokens, if the word isn’t a stopword or punctuation, then bring the word back to its stem, and append the word to tweets_clean</li><li><strong><em>Output</em></strong>: tweets_clean, list of words containing processed tweet</li><li><strong>Step C Build frequency table</strong> (def build_freqs(tweets, ys)) → get your post &amp; neg frequencies of each word!</li><li>We now want to create an overview of all the words in our corpus (training set), and count how often each word is used in a positive or negative setting. Note: rather than looking at a word and estimating whether it is considered positive or negative, we use our training set to tell us how often each word is mentioned in a positive or negative tweet. Hence, the word ‘happy’ will probably be mentioned a lot in our positive tweets, but it might also be used in a negative tweet (e.g. “I am not happy”).</li><li><strong><em>Input</em></strong>: tweets and real ys (real sentiment labels 1 for positive tweet, 0 for negative tweet)</li><li>Go over each tweet and each y (sentiment label)</li><li>and push each tweet through your process_tweet function to get a cleaned up, tokenized version of your tweet.</li><li>With each cleaned up word of your tweet, create a pair of (word, sentiment (y))</li><li>And add a count of 1 to your frequency dictionary each time that the word with this specific label is discovered in a new tweet</li><li>If it’s a new word that hasn’t been registered, then register the word and its sentiment and assign it a frequency of ‘1’, as it has been registered for the first time</li><li><strong><em>Output</em></strong>: a frequency dictionary: an overview of our words, their sentiment, and a frequency</li><li><strong>Step D Extract the features</strong> (def extract_features( tweet, freqs)) → Now we will finally build our encoded version of the tweets to insert into our logreg model!</li><li>We end up with a 3-column row for each tweet: a bias unit, a sum of all positive counts of the words in that tweet, and a sum of all negative counts of the words in that tweet</li><li><strong><em>Input</em></strong>: a tweet, and the frequency table</li><li>Create a 1 x 3 vector for each tweet and initialize with zeros so that our function has a template in which to store the features</li><li>For each tokenized tweet consisting of a list of words, go over each word,</li><li>If we find that particular word in the positive sentiment with its associated frequency (number of times that that word occurred in all of our tweets together), then for that tweet, add its frequency to the ‘positive sentiment’ column. If we cannot find that particular word (because it might be a stopword), then don’t do anything</li><li><strong><em>Output</em></strong>: data matrix X: an overview of all training examples, with for each tweet only 3 column features: a bias unit, a sum of positive frequencies, and a sum of negative frequencies</li></ul><h4>Step 2. Train your model (def gradient descent (X, y, thetas, alpha, num. iter)) → we are now ready to train our model, come up with our optimal theta values, and define our hypothesis function to determine the sentiment of new tweets</h4><ul><li><strong><em>Input</em></strong>: data matrix X, Y, initial theta parameters, learning rate alpha, number of iterations)</li><li>Initialize your data matrix X with zeros</li><li>Fill your data matrix X by using our extract_features() function</li><li>Set Y to train_y (real sentiments of the tweets!)</li><li>Apply gradient descent by starting with 3 zero thetas, calculating the cost over the whole training set (comparing how far each predicted sentiment is to its real sentiment, performing gradient descent, updating the thetas, and continuing this exercise for a fixed number of iterations (let’s say that after 1500 times looping over the data we will have arrived at our optimal thetas).</li><li><strong><em>Output</em></strong>: our optimal theta parameters for which the cost is minimized.</li></ul><h4>Step 3. Predict the sentiment of a new tweet (def predict tweet( tweet, freqs, theta)) → Once we have trained our model, we are eager to know whether we can correctly predict the sentiment of a new incoming tweet!</h4><ul><li><strong><em>Input</em></strong>: a new tweet, the frequency table, and optimal theta parameters</li><li>Extract the features of the tweet via def extract_features()</li><li>Predict with new hypothesis (sigmoid) function with optimal thetas</li><li><strong><em>Output</em></strong>: y_pred: the probability of a tweet being positive or negative, ranging from 0 to 1.</li><li>Eg:</li></ul><p>I am happy -&gt; 0.518580</p><p>I am bad -&gt; 0.494339</p><p>this movie should have been great. -&gt; 0.515331</p><h4>Step 4. Check performance using the test set (def test_logistic_regression (test_x, test_y, freqs, theta)) → use our test set to check performance on unseen data</h4><ul><li><strong><em>Input</em>:</strong> test_x ( list of test tweets), test_y ( m*1 vector with corresponding labels for the list of test tweets, our frequency dictionary, and optimal thetas</li><li>Create empty y_hat array for storing our predictions</li><li>Go over a test tweet, get the label prediction for the tweet y_pred (probability from 0 to 1)</li><li>If the probability is equal to or higher than 0.5, append ‘1’ to our y_hat array for a positive prediction</li><li>If the probability is lower than 0.5, append ‘0’ to our y_hat array for a negative prediction</li><li>Calculate the model’s accuracy by comparing our predictions (y_hat) to our test_y (real y labels), counting the instances where they align, and dividing by all test samples</li><li><strong><em>Output</em>:</strong> accuracy of our model</li></ul><h4>Step 5. Perform error analysis</h4><ul><li>Check misclassified tweets and identify why they are misclassified.</li></ul><p>That’s it! Thanks to the folks at deeplearning.ai for this awesome lesson. See you next week with NLP &amp; Naive Bayes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb899fbab1e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to NLP: bag of words is an overview of the words in your documents]]></title>
            <link>https://mireillebobbert.medium.com/intro-to-nlp-bag-of-words-is-an-overview-of-the-words-in-your-documents-45492a521e66?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/45492a521e66</guid>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Sun, 21 Jun 2020 09:55:49 GMT</pubDate>
            <atom:updated>2020-06-21T10:15:28.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0t6NC6CmSw4JbGV678q5HQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ptFs_ucosifRk9-rDROTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6WO8j2d2BT6MQFyZUM3YpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bm9LAd05uiO0sC25CmoaiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zfVU-iq_ofTWdB8cgsBZzQ.png" /></figure><p>Check out my jupyter notebook for the transformation from sentence to bag of words on my <a href="http://bag-of-words-example-bowie.ipynb/">github</a>. Source code taken from <a href="https://www.amazon.com/Introduction-Machine-Learning-Python-Scientists/dp/1449369413">Muller &amp; Guido: Introduction to Machine Learning with Python</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45492a521e66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Imagine logistic regression as a hungry snake predicting whether an object in his vicinity is…]]></title>
            <link>https://mireillebobbert.medium.com/imagine-logistic-regression-as-a-hungry-snake-predicting-whether-an-object-in-his-vicinity-is-3f43f13e5a7a?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f43f13e5a7a</guid>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[cartoon]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[stanford]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 18:58:35 GMT</pubDate>
            <atom:updated>2020-06-08T18:58:35.566Z</atom:updated>
            <content:encoded><![CDATA[<h3>Imagine logistic regression as a hungry snake predicting whether an object in his vicinity is eatable</h3><figure><img alt="Header image logistic regression" src="https://cdn-images-1.medium.com/max/1024/1*6EqLRZ7djb4_hES4iSQDXQ.png" /><figcaption>Header image logistic regression</figcaption></figure><p>After the <a href="https://medium.com/@mireillebobbert/remember-linear-regression-as-walmart-predicting-their-spectre-32-tv-sales-based-on-ad-spend-e2853ce9c0d3">linear regression recap</a>, it’s time for logistic regression. Whereas with linear regression we’re predicting an output that can take on any real value, logistic regression enables us to classify an item and place it in a bucket. Let’s hit it!</p><h3>Logistic regression is a form of supervised learning used for classification problems</h3><figure><img alt="Logistic regression is a form of supervised learning" src="https://cdn-images-1.medium.com/max/1024/1*uTfmuIJQwMPQ0oRwIiq8yw.png" /><figcaption>Logistic regression is part of supervised learning</figcaption></figure><p>Today we’re discussing logistic regression. The main source for this article is <a href="https://www.coursera.org/learn/machine-learning?">Stanford University’s Machine Learning course</a>, week 3.</p><h3>The goal of logistic regression is to predict the probability that a certain output is positive</h3><p>Applying linear regression to classification problems isn’t the best idea, because of various reasons. First, the linear line of linear regression cannot place data points in buckets. Furthermore, for linear regression, the predicted y of the hypothesis can be much bigger than 1, or smaller than 0, while logistic regression only takes on values between 0 and 1. Last, classification is not a linear function. In fact, the values we want to predict take on only a small number of discrete values between 0 and 1 (eg spam = 1, vs no spam = 0).</p><figure><img alt="The hypothesis for logistic regression becomes a sigmoid function" src="https://cdn-images-1.medium.com/max/1024/1*CPLjUqqYMbqlZGjzYe70KQ.png" /><figcaption>The hypothesis for logistic regression becomes a sigmoid function</figcaption></figure><p>The <strong>goal of logistic regression</strong> is to predict whether an input variable <strong>falls into a specific bucket</strong> (value = 1) or not (value = 0). Therefore, we want to come up with theta parameter values that are needed to come up with a logistic function. The <strong>sigmoid function</strong> is a good way to plot a logistic function. The hypothesis is hence now a sigmoid function, compared to a linear line as we learned previously for linear regression. Imagine the shape of sigmoid like a snake.</p><p>Predicted values of our new hypothesis sigmoid function range between 0 and 1. In the case of predicting spam email, if the predicted value is larger than 0.5 we classify it as spam (1). If the predicted value is smaller than 0.5, we classify it as no spam (0).</p><h3>Use binary logistic regression when the variable y that you want to predict is valued (takes on one of two values)</h3><p>We use logistic regression to predict a variable y that is valued (falls into one of two buckets). Some examples:</p><ul><li>does someone have COVID-19 or not?</li><li>is a new incoming email spam or not?</li><li>is a tumor malign or not?</li><li>is the animal on a picture a cat or not?</li><li>is a payment fraudulent or not?</li></ul><h3>The hypothesis gives us the probability that our output is 1</h3><p>If the hypothesis is 0.7, there is a 70% chance that our output is 1. The probability that our prediction is 0 is the complement of the probability that it is 1 (30%).</p><h3>The decision boundary is the line that separates the area where y = 0 and where y = 1</h3><figure><img alt="The decision boundary separates our classes" src="https://cdn-images-1.medium.com/max/1024/1*XCmVp1li-vWMcafZBHvJIA.png" /><figcaption>The decision boundary separates our classes</figcaption></figure><p>The decision boundary is created by our hypothesis (sigmoid) function. We predict that y = 1 when z (our input to sigmoid, or theta transpose * x) is equal or larger than 0. If the input to the sigmoid function is equal or greater than 0, then the sigmoid g(z) will be greater or equal to 0.5.</p><p>We predict that y = 0 when z (input to sigmoid, theta transpose * x) is smaller than 0. If the input to the sigmoid is smaller than 0, then the hypothesis g(z) is smaller than 0.5.</p><figure><img alt="The sigmoid function enables us to predict y = 1 if z is equal to or larger than 0.5" src="https://cdn-images-1.medium.com/max/1024/1*jm9Vi0Rj_NjgKv5imq2Eow.png" /><figcaption>The sigmoid function enables us to predict y = 1 if z is equal to or larger than 0.5</figcaption></figure><p>Let’s close off with a practical example on decision boundaries.</p><figure><img alt="A practical example of decision boundaries" src="https://cdn-images-1.medium.com/max/1024/1*EVZ6GlHsCULVSSEpoG-bSQ.png" /><figcaption>A practical example of decision boundaries</figcaption></figure><p>We are dealing with non-linear decision boundaries when the boundary does not follow the shape of a linear line.</p><h3>The cost function consists of two parts: the case that y=1, and y=0</h3><figure><img alt="We need to make the cost function for logistic regression convex, so that we can find a global minimum" src="https://cdn-images-1.medium.com/max/1024/1*zgdtOOyPAJZ55kTmu8NDNg.png" /></figure><p>The cost of J is equal to half of the squared error (squared error = difference between our predicted y and real y). However, we’re facing a problem with the squared cost function for logistic regression, because we have a nonlinear sigmoid function that we put in the middle of the quadratic cost function. In this case, J of theta turns out to be a non-convex (non bowl-shaped) function if you define it as a squared cost function. Unlike what we learned in our linear regression lecture where we always reach a global minimum as J of theta is convex, plotting J of theta would result in a non-convex function, where there are lots of local minima. Therefore, we want to figure out a cost function that <em>is</em> convex, i.e., we are able to find a global minimum.</p><p>It turns out we can come up with a cost function for logistic regression by combining the case for which y = 1, and y =0.</p><figure><img alt="With logistic regression, our cost of J consists of 2 parts" src="https://cdn-images-1.medium.com/max/1024/1*shpHZi11f00djZX9cNMK8w.png" /></figure><p>Here’s why it’s costly to predict a wrong outcome. Let’s imagine you have COVID-19 (y=1), and the doctors predict you’re healthy (hyp = 0). You’ll walk out of the doctor’s office thinking you’re fine while you’re not. Consequently, the cost will be super high: you’ll go outside, have walks in the park, and infect lots of other people. If you have the disease (y=1) and doctors confirm so (hyp = 1), you’ll stay inside for 2 weeks, suck it up, and you’re probably going to be OK. The cost will be zero. On the other hand, let’s imagine you’re healthy (y=0) but doctors predict you’re ill (hyp = 1). You come home depressed thinking you’re deprived of having walks in the park, enjoying the sun, saying hi to a friend, and going for a run in fresh air. The cost is immensely high. If you are healthy (y=0) and doctors confirm so (hyp = 0), everything’s good and the cost is zero.</p><figure><img alt="Wrongly predicting an outcome has terrible consequences" src="https://cdn-images-1.medium.com/max/1024/1*K1EFTDwM6Wxcug6FWfBreg.png" /></figure><h3>Gradient descent for logistic regression</h3><p>The gradient descent formula is the same as the one for linear regression. Here’s an overview of the non-vectorized and vectorized implementation.</p><figure><img alt="Gradient descent for logistic regression" src="https://cdn-images-1.medium.com/max/1024/1*cj78LOyLsC3XPOaT-9s9-Q.png" /></figure><h3>Multiclass classification (one vs all) uses binary classification for each class predicting that ‘y’ is a member of one of the categories</h3><p>For multiclass classification, we perform binary classification for each class that we’re predicting. This means that if we have k classes, we will train k different logistic regression classifiers to predict the probability that y = 1. We use the hypothesis that gives us the highest value of the different classes as our prediction. Let’s say we’re predicting email to fall into class ‘friends’, ‘family’, and ‘work’, a new email comes in, and the respective hypothesis outcomes are 0.7, 0.5, and 0.6, then we’ll predict the incoming email as ‘friends’, as the hypothesis has the highest value for this category.</p><h3>Potential problems that you might run into forming a hypothesis are overfitting and underfitting</h3><h4>With underfitting, the model is too simple for the trend of the data</h4><p>Underfitting happens when your hypothesis doesn’t represent your training data well enough; it’s too simple and has too little features. It’s a poor fit to the training data. It’s paired with high bias: it thinks it knows the data very well while in fact it doesn’t. In a university setting, you can compare it to a cocky or lazy classmate who’s confident of knowing the course material but only flipped through a course material summary minutes before D-day. He gets to the exam and realises he (or she) knows sh*t. He was under the preconception of having it covered while that wasn’t the case.</p><figure><img alt="The difference between underfitting and overfitting" src="https://cdn-images-1.medium.com/max/1024/1*-y9MBTIt420c05ctz7aQHw.png" /></figure><h4>With overfitting, the model is too complex and therefore poorly generalizes to predict on new examples</h4><p>With overfitting, your hypothesis <strong>doesn’t generalize to new examples</strong> outside of your training set very well. It is too keen of your training data. This problem occurs when you’re dealing with <strong>many features</strong>, and your hypothesis becomes this highly flexible line with too many unnecessary curves. In fact, the hypothesis has become too complicated. In a university setting, you can compare it to having studied your ass off for several days and knowing every tiny little detail for an exam but then failing anyway: rather than a simple multiple choice exam, the professor asks you to put the knowledge to practice via open-ended answers. You’re unable to, as you realize you didn’t <em>really</em> understand the subject. You can’t ‘go with the flow’ and apply the learned knowledge in different ways.</p><p>You can address overfitting by reducing the number of features, or applying regularization. The problem with reducing the number of features is that we throw away information about the problem, which might be disadvantageous. <strong>Regularization</strong> is a better proposal: it means we keep all the features, but <strong>reduce the magnitude of the theta parameters</strong>. Applying regularization is especially a good idea when we really don’t want to get rid of features as they all have some predictive power.</p><h3>Regularization is the key to success when we don’t want to get rid of features that are all slightly useful</h3><figure><img alt="The effect of regularization on the theta parameters" src="https://cdn-images-1.medium.com/max/1024/1*kmy89w4hHQion3g4tHo5sw.png" /></figure><p>Regularization makes sure that some of our parameters have less influence on the hypothesis than they do in reality. The result is a simpler hypothesis that is less prone to overfitting.</p><p>We can reduce all theta parameters at once, by using a regularization parameter called lambda. Lambda helps us regulate to what extent our theta parameters are inflated, and controls the tradeoff between two different goals. On the one hand, we want to find a good fit for our training data (by keeping all parameters). On the other hand, we want to keep the theta parameters small.</p><h3>Choose your regularization parameter wisely</h3><p>The regularization parameter can have a large influence on your hypothesis. If lambda is very large, we will penalize the thetas a lot. We end up with those parameters to be extremely small and it’s is as if we’re crossing out those parts of the hypothesis. This would result in fitting a straight horizontal line through the data, and we would end up with a model that is too simple (underfitting).</p><p>Therefore it is important to choose lambda well. Remember that lambda is used to fight against overfitting:</p><ul><li>if lambda is too <em>large</em>, it will result in <em>underfitting</em></li><li>if lambda is too <em>small</em>, it <em>won’t be a remedy</em> to the problem of overfitting, because you practically will end up with the old hypothesis</li></ul><h3>Practical example: let’s predict whether a student is admitted to Stanford based on 2 exams</h3><p>Let’s look at a practical example: Stanford’s Machine Learning Octave assignment 2 week 3. We are the administrator of a university and have to come up with a model that determines the chance of a student being admitted based on two exams. We have historical data.</p><figure><img alt="Octave assigment 2 week 3 Stanford University Machine Learning" src="https://cdn-images-1.medium.com/max/1024/1*ykBjWtrObrQDxuwzqPZV1Q.png" /></figure><h4><strong>Let’s recap we’ve learned about logistic regression</strong></h4><ul><li>Logistic regression is suited to <strong>classify items into buckets</strong>: is an email spam or not, does someone have COVID-19 or not?</li><li><strong>Hypothesis values range between 0 and 1</strong> and the hypothesis function becomes a <strong>sigmoid function</strong>. The hypothesis gives us the probability that our output is 1.</li><li>If the input to sigmoid (z) is equal or larger than 0, then the output is equal or larger than 0.5, and we predict y = 1.</li><li>If the input to sigmoid (z) is smaller than 0, then the output is smaller than 0.5, and we predict y = 0.</li><li>The decision boundary divides items into groups (2 groups for binary logistic regression, or more groups for multiclass classification)</li><li>The <strong>cost function</strong> for logistic regression <strong>consists of 2 parts</strong>: the case for which y = 1, and y = 0.</li><li><strong>Cost will go to infinity when we wrongly predict an outcome</strong> (e.g. when we predict someone has COVID-19 while they don’t (because she will be deprived from going outside for no reason), or when we don’t predict that they have it, while they do (because she will infect other people). The cost function captures this nicely.</li><li>Potential problems with forming a hypothesis are overfitting and underfitting. We can fight overfitting by adding <strong>regularization</strong> parameter lambda to the cost function. This <strong>helps reduce the influence of each feature on the hypothesis</strong>. Underfitting is solved by adding more features.</li></ul><p>That was it! Next up: neural networks!</p><p>PS. This is a recap from my notes from <a href="https://www.coursera.org/learn/machine-learning?">Stanford’s Machine Learning course</a>, week 3.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f43f13e5a7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remember linear regression as Walmart predicting their Spectre 32" TV sales based on ad spend]]></title>
            <link>https://mireillebobbert.medium.com/remember-linear-regression-as-walmart-predicting-their-spectre-32-tv-sales-based-on-ad-spend-e2853ce9c0d3?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2853ce9c0d3</guid>
            <category><![CDATA[cartoon]]></category>
            <category><![CDATA[coursera]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 07:06:18 GMT</pubDate>
            <atom:updated>2020-06-15T18:35:19.515Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4MIs4cqxh7qxkyAtwGgsg.png" /><figcaption>Linear regression: Walmart predicting Spectre 32&quot; TV sales based on ad spend</figcaption></figure><p>Two years ago I was hugely inspired by a machine learning <a href="https://www.mireillebobbert.com/2019/01/29/problems-worth-solving-challenge/">piece of art</a> by Studio Drift at the Stedelijk Museum in Amsterdam. Enthusiastically, I started <a href="https://www.coursera.org/learn/machine-learning">Stanford’s Machine Learning</a> course, and was able to get a business case at work on natural language processing. Throughout the process of getting into machine learning I got discouraged (e.g. some concepts like recurrent neural networks are extremely hard to grasp and I felt like an imposter) and wondered where exactly the challenge was in implementing machine learning models if tools do the work for you (e.g. Azure’s Machine Learning Studio or Automated ML allow you to implement a bunch of models and spit out the best one). I put it aside for one year, until I recently got re-inspired by ML. I realized there were so many cool things I learned during <a href="https://www.coursera.org/learn/machine-learning">Andrew Ng’s intro to machine learnin</a>g and other books and courses and lived and breathed at the time, that it would be a shame to loose this knowledge. Hence, I’ve decided to make a recap of some of ML’s core concepts. Who knows where this journey might take me. Let’s find out! First up: linear regression. I recently bought a house, so let’s take house hunting as an example use case.</p><h3>Linear regression is a form of supervised learning</h3><p>Linear regression belongs to the <strong>supervised learning</strong> branch of machine learning. First we’ll discuss univariate linear regression, meaning we’re dealing with only one input variable and one output variable. With our house hunting use case, we can ask ourselves the question: “To what extent does house size (independent variable) affect house price (dependent variable or target variable)?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwYsKwrGC6UGGxqEJqTSJQ.png" /><figcaption>Linear regression is a form of supervised learning</figcaption></figure><h3>The goal of linear regression is to find the hypothesis function that best fits the historical data points</h3><p>The goal of linear regression is to <strong>find the fitted line that best represents the training data points</strong>. These data points usually consist of <strong>historical data</strong>. It aims to create a linear line that fits historical data points as closely as possible in order to predict an outcome based on one input variable. In the case of house hunting, the training data will consist of an overview of house sizes (independent variable) and the corresponding sold house prices (dependent variable). Applying univariate linear regression to determine a house price is not very realistic; when I bought a house I took into account various factors to determine my bid besides house size like location, construction year and external living space. But for the calculation of my final bidding price I went back to basics and looked up an overview of house prices and their sizes on <a href="https://www.kadaster.nl/about-us">kadaster.nl</a>, the Dutch housing website that registers all sold house prices. Let’s pretend Kadaster was my only data source to determine my bid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ksRsb5MDPlZxsY3kONXKg.png" /><figcaption>The goal of linear regression is to find the hypothesis function that best fits the historical data points</figcaption></figure><h3>Use linear regression to predict a continuous output variable</h3><p>We use linear regression to predict a <strong>continuous output variable</strong>. A continuous output variable means that the output can have any real value. For example, based on the number of squared metres, we want to predict the housing price. The house price can range from 1 euro (not very likely) to millions of euros.</p><h3>Determine the fitted line that best represents the historical data</h3><p>For linear regression, our fitted line is linear. You might remember from school a long time ago that a linear line is represented by the formula y = a + bx, where a is the point that crosses the y-axis and b is the slope of the line. The goal is to find the values of a and b that best represent our historical house prices. Once we have these values, we can plug any value into the hypothesis, and get a predicted value. The values a and b are called parameters. In the field of machine learning, these parameters that we need to determine are called thetas. To distinguish the different parameters, we call ‘a’ theta zero, and ‘b’ theta one. I agree that ‘theta’ isn’t a word that rings many bells, but for now let’s just embrace this odd naming and move on to more exciting insights.</p><p>I’ve now given you the hypothesis function, but how exactly can we calculate these optimal values of theta zero and theta one?</p><h3>Minimize the cost of J to come up with the best fitted line</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KyofPtHttgZ3KlBcgU_XQ.png" /></figure><p>In order to come up with the fitted line that best represents our historical data, we want to measure to what extent our hypothesis is actually doing a good job in fitting our data points. We use the cost of J to help us with this exercise. This formula will help us calculate to what extent our fitted line fits the historical training data points. The goal is to <strong>minimize the sum of the squared differences</strong> between the <strong>predictions</strong> of housing prices and the <strong>actual</strong> housing prices. The higher the cost of J, the worse our line fits our data. Hence, to find our best fitted line, we want to minimize the cost! Btw, again, this naming ‘cost of J’ doesn’t sound very intuitive. However, just remember that each of the lines that you’ll plot to check whether they fit your historical data have a certain cost. This cost happens to be called the cost of J.</p><p>Here is what’s needed step by step to calculate the cost of J.</p><p>Step 1. Generate the hypothesis for the specific parameter values of Theta 0 and Theta 1.</p><p>Step 2. Draw the line that belongs to those parameters.</p><p>Step 3. Calculate the difference between the predicted output value based on the hypothesis, and the actual (historical) training data point. Repeat for all training data points: see how far the line is from each training data point.</p><p>Step 4. Square those differences.</p><p>Step 5. Add these differences for all training data points.</p><p>Step 6. Multiply by 1/(2m).</p><p>Step 7. Outcome is your cost.</p><p>Step 8. Plot J against your parameters. A convex (bowl) function will appear.</p><p>Step 9. Continue this process until you’ve reached the minimum cost of J.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KIRy6LPUVZfCw8NMOzVG1w.png" /><figcaption>Minimize the cost of J to come up with the best fitted line</figcaption></figure><p>In order to calculate the cost you need specific parameter values for theta 0 and theta 1. Let’s start by a simple example and come up with our own parameter values.</p><p>Simple use case: we’re on the dollhouse housing market.</p><p>Let’s say we have 3 historical data points about housing prices, and let’s pretend we’re into the doll-house housing market. Last month, a house of 1 squared meter was sold for 1 euro, a house of 2 squared meter was sold for 2 euros, and a house of 3 squared meter was sold for 3 euros. We plot these data points in a graph to see what it looks like. Check the plot in the infographic below.</p><p>We will then come up with random values for theta 0 and theta 1 that we will plug into the hypothesis. We start with theta 0 = 0 &amp; theta 1 = 0 and calculate the cost. We’re plotting the cost against our thetas and see what happens to the cost. We repeat this process for theta 0 = 0 and theta 1 = 0.5, and theta 0 = 0 and theta 1 = 1. Eventually, we come to realize that our Cost of J is minimized for theta 1 = 1. Hence, for theta 1 = 1, we can draw a line that best represents our historical data points. To do so, we plug this theta value value into our hypothesis function and generate our fitted line h(x) = x. Let’s say we’re currently looking at a superdeluxe doll-house in the center of Amsterdam with view over the Amstel river. It’s 10 squared meters. How much will the house price be? Plug it into the hypothesis and we’ll find out: h(10) = 10. The house price will be 10 euros!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OimL3TwG98dl2Q4jCwaMFA.png" /><figcaption>Linear regression step by step</figcaption></figure><h3>Learning via gradient descent automatically brings us to the lowest cost of J</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FA8eBBJ4qgCI_J3pftgpbA.png" /><figcaption>The goal of gradient descent is to find the parameter values you need to get to the minimum cost of J</figcaption></figure><p>As you might have noticed, to calculate our cost for a specific hypothesis, we take into account all our training examples (e.g. our historical sold house prices). If we have a dataset with millions of records, it would take us forever to get to the minimal cost, because we would have to go through each single one of the million records to come up with a new cost, again and again, until we’ve found the minimum cost. Furthermore, in the previous example we chose 3 random sets of values of theta 0 and theta 1 (Theta 0 = 0 &amp; theta 1 = 0, theta 0 = 0 and theta 1 = 0.5, and theta 0 = 0 and theta 1 = 1), and happened to find the parameter values for which the cost was minimized ( this proved to be the case for theta 0 = 0 and theta 1 = 1), but for millions of training examples, it’s impossible to find these optimal parameter values by coincidence. So we really need some help. Luckily, gradient descent comes to rescue.</p><h4>What is gradient descent?</h4><p>Gradient descent is a procedure that helps us find the minimum cost of J, enabling us to obtain our optimal theta parameter values to represent our training data. It consists of two steps: First, we calculate the change — or, a step / the gradient — to our theta parameter values. Then, we update our parameter values. If gradient descent works correctly, our steps should become smaller and smaller. To calculate a step, we use the slope of the cost of J. Calculating the slope of the cost of J consists of summing the slopes between each training example and its predicted value. We have reached the global minimum cost of J when its slope is close to 0.</p><h4>Why do we use gradient descent?</h4><p><strong>We use gradient descent to find the parameter values of theta 0 and theta 1 for which the cost of J is minimised</strong>. These parameter values will enable us to create the best fitted line through the training data, and will allow us to predict an output variable for new incoming input data (i.e. to predict the house price (target variable) based on a specific house size (input variable/ independent variable)). We will come up with linear lines throughout each step of gradient descent, but once we reach the global minimum, we can fix the fitted line because we found our parameter values of theta 0 and theta 1 that best represent the historical data set.</p><h4>Gradient descent step-by-step</h4><p>Step 1. Calculate the hypothesis (prediction)</p><p>Step 2. Use that to calculate the cost. Note that for calculating the cost we take into account ALL training examples (hence calculate the hypothesis also for each training example)</p><p>Step 3. We do gradient descent to, via the slope through each training example x(i), get the updated parameter values. The sign of the slope tells you which direction to move to.</p><p>Step 4. With these new parameter values, you get a new hypothesis which you use to calculate the cost. Check whether the cost decreased. If it did, you’re moving into the right direction. Decreased cost means the hypothesis line already better represents your data than it did with the previous parameter values.</p><p>Step 5. If everything goes well (e.g. you’ve chosen a good learning rate), gradient descent should take smaller steps over time, because the slope through x(i) should decrease. Once the slope is 0, you’ve reached the global minimum.</p><p><em>Update until convergence</em></p><p>‘Updating until convergence’ may sound a little vague. It means you should update your theta 0 and theta 1 values</p><ul><li>theta (j) = theta (j) — alpha * slope of J (derivative term). Subscript ‘j’ refers to feature j.</li><li>When the learning rate alpha is too large, gradient descent will overshoot the minimum, but when it is too small, it will take too long to converge. That’s why it’s necessary to choose a correct learning rate.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogURiLHTbz2x_8B49xEC-Q.png" /><figcaption>Gradient descent step by step</figcaption></figure><h4>Slopes 101</h4><p>Let’s look at a little slope refresher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wRDXvkhWG77YTFJQYYoGgw.png" /><figcaption>Slopes 101</figcaption></figure><ul><li>If the slope is positive, gradient descent will be updated by a negative number and will become smaller, because the second part of gradient descent ( — alpha * slope of J ) is positive ( — alpha * positive number = negative number, hence X — negative number becomes smaller). Gradient descent will move towards the left. This makes sense, as it is moving towards the global minimum of the cost function.</li><li>If the slope is negative, gradient descent will be updated by a positive number and will become bigger, because the second part of gradient descent is negative ( — alpha * negative number = positive number, hence X + positive number becomes bigger). Gradient descent will move towards the right. This makes sense, as gradient descent will move towards the global minimum.</li><li>As gradient descent reaches the global minimum, the second part of gradient descent (- learning rate * derivative term) will become smaller and smaller because the slope will get flatter (hence smaller) with each step. You know you’re reaching the global minimum if steps of gradient descent become smaller and eventually get close to 0, because global minimum has a slope of 0.</li></ul><h4>The importance of choosing your learning rate carefully</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20GOw75xHMAdojprUE7dVg.png" /><figcaption>The importance of choosing your learning rate carefully</figcaption></figure><p>The learning rate is an important part of gradient descent. It’s important to choose a correct learning rate: a rate too small will take you forever to reach the minimum, while a rate too large might inhibit you from finding the minimum at all.</p><h4><strong>Some things to keep in mind regarding linear regression</strong></h4><ul><li>Choose your learning rate wisely: when the learning rate is too large, you will overshoot the minimum. When the learning rate is too small, it will take too long to converge.</li><li>For linear regression, there will be one global minimum, as J is a convex (bowl) quadratic function.</li><li>Gradient descent for linear regression uses batch gradient descent. This means that for each step of gradient descent, it takes into account all training data points. This makes sense, because in order to come up with a new fitted line, it needs to know the location of each data point before it can make a good estimation of what the next fitted line should be.</li><li>It’s important to update theta 0 and theta 1 simultaneously, because the line adjusts as a whole. If you don’t update them at once, you won’t be able to come up with a new line, which prevents you from coming up with an updated cost, which in turn prevents you from performing gradient descent.</li><li>Theta 0 indicates where to cross the Y-axis, whereas theta 1 determines the slope of the line.</li><li>The number of iterations refers to the number of times gradient descent starts over to update the thetas. The question is how many iterations are just enough to get to the minimum. There are different ways to solve this problem, for now let’s say we used a fixed number of iterations and assume that the last iteration will get us very close to a zero slope and incredibly tiny update to our theta parameters which will bring us close enough to reaching global minimum, and providing us with our optimal parameter values to draw the linear line.</li><li>You can reach global minimum even with a fixed learning rate, because with a decreased slope at each step of gradient descent, the updates to theta become smaller, until they won’t update anymore once you’ve reached a slope of zero.</li></ul><h3>Linear regression in action</h3><p>Let’s close off with a practical example from Stanford’s Machine Learning week 2 assignment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LlFNa0D48I_jNREtDhiuqw.png" /><figcaption>Linear regression practical example Stanford Machine Learning week 2</figcaption></figure><h4><strong>Key takeaways linear regression with one variable</strong></h4><p>Let’s recap what we’ve learned:</p><ul><li>The goal of linear regression is to <strong>come up with a linear line</strong> that matches your training set (historical data points) as closely as possible</li><li>Once you’ve come up with this <strong>linear line</strong>, you are able to <strong>make predictions</strong> with new input data</li><li>You get to this linear line by <strong>plotting different linear lines over and over</strong>, and <strong>calculating the cost </strong>of J for each line. The cost of J is a <strong>measure of how well your linear line fits the historical data points</strong>. It calculates the sum of the squared errors. In simple terms, it checks how far each historical data point is from its predicted value, squares those differences and multiplies it by a certain number.</li><li>Because it’s <strong>impossible</strong> to calculate the cost of J for <strong>huge data sets</strong> ( and come up with new combinations of theta values over and over), <strong>gradient descent comes to rescue</strong>.</li><li>Gradient descent will help us <strong>find the parameter values of theta 0 and theta 1 for which the cost is minimized</strong>. Once we have these parameter values, we can come up with our linear line and start predicting with new input values.</li><li>Gradient descent searches for the global minimum of the cost of J, by calculating the cost of J for different linear lines, and looks for the <strong>direction</strong> to move towards to get to this global minimum. For linear regression, there will always be only one global minimum because we are dealing with a bowl-shaped function.</li><li>In order to check whether you’re reaching global minimum, the cost of J should become smaller and smaller (we are looking for a cost close to 0). Also, the derivative term of gradient descent should become smaller because the cost of J will reach global minimum where the slope is zero.</li><li>Make sure you choose an <strong>appropriate learning rate</strong> for gradient descent that is neither to small nor too large, as you don’t want gradient descent to last forever or let it overshoot the global minimum.</li><li>For gradient descent to run properly, it’s important to <strong>update your parameter values theta 0 and theta 1 simultaneously</strong>, because these two values help you come up with your new linear line. If you’re not updating these values simultaneously, you won’t execute gradient descent with an updated linear line.</li></ul><h3>Linear regression with multiple variables (multivariate linear regression)</h3><p>Let’s say that now I would like to take into account the number of bedrooms, floors and age of the house besides size to calculate the house price. We can take all of these features into account by using multivariate regression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGlvd3HQ8ZQigY_jGhqWXA.png" /></figure><h4><strong>How multivariate regression compares to univariate regression</strong></h4><ul><li>The cost function is the same, except that the hypothesis has changed to include more parameters.</li><li>Rather than having only 2 thetas to update (theta 0 to know where the linear line is crossing the y-axis and theta 1 to know the slope of the linear line for univariate regression), we now perform gradient descent for n features (still taking into account all training examples for each step of gradient descent). Eg., for theta 4 (number of bedrooms), we take into account the number-of-bedrooms feature values of all training examples (j=4) and multiply these with the errors (hypothesis — real y values) of all training examples to calculate the slope for theta 4 and subsequently the update to theta 4.</li><li>It is still important to update all thetas simultaneously.</li><li>When performing multivariate regression it’s important to apply feature scaling and mean normalization to speed up gradient descent, because the theta vector with theta for each variable will descend more quickly on small ranges.</li><li>Mean normalization means you subtract the average value of the training set for an input variable to make features have a zero mean. For example, if you look at house size and several training examples have an average size of 1000 sq. metres, you subtract 1000 from the feature house size for each training example.</li><li>Feature scaling makes sure your features range from -1 to 1. For each training example’s feature n, divide (original feature value — average) by the range (max-min) or standard deviation.</li><li>For the vectorized approach of calculating the cost of J and performing gradient descent, remember that the theta vector holds all parameters (vertically). The data matrix X holds the data of all training examples. Each row holds the data for 1 example; the columns represent the features. Theta 0 is the point where y-axis is crossed. In order to match the Theta vector with the design matrix (which has one column less than the theta vector as it misses on x(0) (training examples start with first feature x(1)), we create x(0) = 1. In that way, matrix multiplication is possible. Another way to look at it is that because the theta vector has one more element than the x(i)-vector, a training example’s data representation of the features, (because the vector of a training example starts with x1 housing size, x2 # of bedrooms, etc.). Hence, in order to perform vector multiplication, we ‘create’ x0, so that the Theta vector and x-vector are of the same size.</li><li>If you don’t go for the vectorized approach, your hypothesis will be h = theta transpose * x, where x is a vector that holds data about features on one training example.</li><li>You need to transpose theta because if you want to multiply two vectors, at least one of them needs to be transposed to be able to multiply.</li><li>Whereas the hypothesis for the vectorized approach will result in a vector of m * 1, the non-vectorized approach will do a for-loop calculating the hypothesis per training example</li><li>To remember about vectorization: in tabular format, each row holds data of 1 training example m. If you look at 1 training example in vector form, data is represented vertically.</li><li>Besides gradient descent, there is another method to come up with the optimal parameter values: by using the normal equation. You can solve for optimal values of theta in one step without doing feature scaling, but gradient descent is easier to comprehend.</li><li>The design matrix holds are you training examples m in a matrix where each training example’s individual vector is transposed.</li></ul><p>That was it for linear regression! Stay tuned for a recap of logistic regression.</p><p>Source input: <a href="https://www.coursera.org/learn/machine-learning">Machine Learning, Stanford University</a>, week 1 and 2</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2853ce9c0d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My One Year Blendle Anniversary: 3 Reasons Why I’ve Grown So Fond of The Service]]></title>
            <link>https://mireillebobbert.medium.com/my-one-year-blendle-anniversary-3-reasons-why-ive-grown-so-fond-of-the-service-79d5836a18ad?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/79d5836a18ad</guid>
            <category><![CDATA[product-reviews]]></category>
            <category><![CDATA[blendle]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[journalism]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Tue, 28 Nov 2017 09:56:00 GMT</pubDate>
            <atom:updated>2017-11-28T09:56:00.760Z</atom:updated>
            <content:encoded><![CDATA[<p>Note: Due to the embedded images by Tableau, this article is best viewed on a tablet or laptop.</p><p>Recently it had been a year since I started using Blendle. Rarely have I been more excited about a news service membership anniversary. In fact, reflecting on the past year with Blendle as my partner in crime to start the day, I’d never imagined to get so much joy out of using this news aggregator.</p><p>These are the three things I love about the service:</p><p><strong>1. A Blendle subscription has given me considerably more value for money than a traditional newspaper subscription</strong></p><p>[<em>NB: If Figure 1 doesn’t display correctly click on ‘more by this author’ at the bottom of Figure 1 to view the graph on Tableau’s website</em>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*p3pA3VQ76jikH_clYNUQ8Q.png" /></figure><p>Note: If you want to see the interactive version, see the image directly in <a href="https://public.tableau.com/views/OneyearBlendleanniversaryFigure1/Figure1?:showVizHome=no&amp;:embed=true">Tableau</a>.</p><p>Figure 1 shows my net monthly Blendle credit spent*, and the return rate**. Over the past year I’ve spent €104 (or €7,97/month), which, compared to a digital daily newspaper subscription is about <a href="https://abonnementen.nrc.nl/nrc-next/bestel">as much</a>. The difference is that with Blendle I’ve gotten more value for money: compared to a newspaper subscription from which I might consume a tenth of the articles, the journalism startup has allowed me to pay exclusively for what I enjoy reading. To illustrate: my highest yearly spending per newspaper is 12 euros (see NRC Next, Figure 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*Df1jwd1JFixxNlsoZMQIiA.png" /></figure><p>Note: If you want to see the interactive version, see the image directly in <a href="https://public.tableau.com/views/Figure1MonthlynetBlendlecreditspentreturnratesep2015-sep2016/Figure2?:showVizHome=no&amp;:embed=true">Tableau</a>.</p><p>Furthermore, I’ve on average returned 19% of the articles that I didn’t like. Add to that a priceless mental benefit — namely that the news app takes away the feeling of urgency to read the newspaper that I’ve experienced when subscribed to a newspaper — and it’s clear that value for money has been considerably higher with Blendle.</p><p>Blendle’s recent all-you-can-read-for-€9,99/month-offer seems to contradict the reasons why I — and I’m sure a lot of other Blendle users — signed up to Blendle in the first place. In the past few days that I’ve tried out its new offer I haven’t been particularly tempted to switch, but let’s see whether I change my mind in the upcoming weeks.</p><p><strong>2. Consuming my daily dose of Blendle means a peaceful start of my day</strong></p><p>You don’t know what you have until it’s gone, is how the saying goes. This definitely holds for Blendle. In the past, I’ve at times been too lazy to top up my Blendle credit whenever I had run out of it. Instead of opening the daily newsletter and reading two to three articles, I browsed Twitter, surfed the internet, or replied to email or WhatsApp messages. Once I realized how much I missed reading a great story during breakfast, I decided it was time to break my bad habit: whenever I’m out of credit, I add some right away. Amen to starting the day peacefully with my favourite news app.</p><p><strong>3. Through Blendle’s vast variety of newspaper and magazine titles, I’ve discovered plenty of great (inter)national magazines that I wouldn’t have discovered otherwise</strong></p><p>The news aggregator’s offer is insanely large: during the past year, I’ve consumed articles from 47 different titles (Figure 2). The service’s broad offer has three benefits. First, the editors at Blendle have introduced me to some pretty cool international titles. In fact, about one fifth of the titles I’ve read is from abroad, and according to my stats I’m into Belgian newspapers: 3 out of my top 10 most read newspapers are Flemish (De Standaard, Knack, de Tijd). Furthermore, the large kiosk enables me to discover titles in the long tail: for 70% of my magazine portfolio I’ve read up to 5 articles (Figure 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*EZ9GZNh4hTt6eCK_06zFaA.png" /></figure><p>Note: If you want to see the interactive version, see the image directly in <a href="https://public.tableau.com/views/Figure1MonthlynetBlendlecreditspentreturnratesep2015-sep2016/Figure3?:showVizHome=no&amp;:embed=true">Tableau</a>.</p><p>This confirms that me and Blendle are a great fit: the magazine aggregator is a great way to learn about niche magazines. Last, I’ve been introduced to a broad range of fields: besides the regular newspapers, I’ve been introduced to opinion magazines (Vrij Nederland, Elsevier, De Tijd), fashion magazines (LINDA, Glamour, Vogue), psychology magazines (Psychologie Magazine, Quest Psychologie), and running magazines (Running.be, Runner’s World). There hasn’t been anything more delightful than reading a hand-picked newsletter featuring such a wide variety of stories.</p><p>It’s clear that me and Blendle have been inseparable for the past year. In light of its recent offer, it remains to be seen whether it will change its proposition, but as long as the pay-per-article model stays in place I would say: cheers to many more years.</p><p>* Net monthly Blendle credit spent = monthly gross credit spent — monthly credit saved from returned articles</p><p>** Return rate = credit from returned articles / (credit from read articles + credit from returned articles)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79d5836a18ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Skepticism to Obsession: How Glossier Convinced me to Splurge $50 in Less Than a Week]]></title>
            <link>https://mireillebobbert.medium.com/from-skepticism-to-obsession-how-glossier-convinced-me-to-splurge-50-in-less-than-a-week-a3743772e0c?source=rss-9dfdae75ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3743772e0c</guid>
            <category><![CDATA[marketing-strategies]]></category>
            <category><![CDATA[beauty]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[glossier]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Mireille Bobbert]]></dc:creator>
            <pubDate>Wed, 22 Nov 2017 09:36:01 GMT</pubDate>
            <atom:updated>2017-11-22T09:36:01.150Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>WHAT?!? Did IntoTheGloss just launch its own make up brand? is the first thing that crosses my mind when I find out about Glossier on ITG. Why would anyone try to launch another make-up brand in this saturated market? To say I am skeptical is an understatement. But my skepticism is replaced by excitement and a great craving when I discover the world of Glossier. And without having tried its products, I become one of its biggest fans. This is quite special, because I usually don’t get hooked until I try the product. But I got hooked to Glossier for reasons other than its products. I am ecstatic about this new makeup brand because of its marketing strategy which is genius.</strong></p><p>At some point last year I was randomly surfing the web and stumbled upon my favourite beauty blog IntoTheGloss, where a banner on the right side of my screen caught my attention. It was an ad for a Get Ready With Me Youtube video showing Emily sitting on the couch with her cat.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8s4qlJLXDuc%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8s4qlJLXDuc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8s4qlJLXDuc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2262d9a260d87649ff354227dfc5005a/href">https://medium.com/media/2262d9a260d87649ff354227dfc5005a/href</a></iframe><p>Once I figured out that apparently, ITG and Glossier were related, I immediately surfed to <a href="http://www.glossier.com/">Glossier.com</a> and checked out the website. I remember being positively surprised, but not entirely convinced just yet. Then I saw the models looking amazing wearing <a href="https://www.glossier.com/products/generation-g">_Generation G</a>, and I remember thinking “OK, fair enough, these women actually look quite fabulous, maybe it’s worth checking out more of this brand”. Within a week, I had revisited its website and social media channels at least fifty times and was desperately craving a <a href="https://www.glossier.com/products/glossier-phase-2">_Glossier Phase 2 set</a>.</p><p>So what exactly caused my willingness to splurge $50 on this unknown brand? And, equally important, do the products live up to the expectations?</p><p><strong>1. THE GLOSSIER COMMUNITY</strong></p><p>The brand’s social media strategy has undoubtedly helped most in increasing my obsession with the brand and convincing me to buy the _Phase 2 set. Rarely have I been more impressed with the love that women have for a make-up brand. They self-promote Glossier all over the place. This is word-of-mouth in its purest form: rather than simply using on-site testimonials (which it still uses, for example on its <a href="https://www.glossier.com/products/balm-dotcom">_Balm.com page</a>, the internet is full of tutorial videos, selfies and tweets with women saying the brand’s products are the best they ever used. And this is exactly what made me crave Glossier more than anything else, because really, if fans are SO in love with it and women worldwide are dying to get their hands on it, then what more do I need to get convinced? This online love has been systematically planned for; Emily stated in Forbes’ Million$ podcast episode <a href="http://www.forbes.com/podcasts/millions/">Skin Is In</a> that she designed her products for the selfie generation. I got especially excited when I discovered Glossier’s #GRWM (Get Ready With Me) Youtube videos, because they allow me to see how real women use the products, and what the products look like once applied. Ofcourse, the #GRWM women are friends, employees or ambassadors of Glossier, but it doesn’t make the videos any less interesting. Some #GRWM ambassadors whose videos I’ve replayed dozens of times are <a href="https://youtu.be/D-Ameu6p02c">Coco</a>, <a href="https://youtu.be/BWxKwzGiHx0">Chrissstttiiine</a>, and ofcourse, <a href="https://youtu.be/8s4qlJLXDuc">Emily herself</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FD-Ameu6p02c%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DD-Ameu6p02c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FD-Ameu6p02c%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8414c792f9345f73cb5c02121c90e0e0/href">https://medium.com/media/8414c792f9345f73cb5c02121c90e0e0/href</a></iframe><p>Besides, Glossier’s <a href="http://www.instagram.com/glossier">Instagram</a> shows even more handy product videos, model shots and selfies from fans wearing the products, and summarizes its product portfolio, identity, and how-to videos. The social media channel that made my eyes grow bigger and my heart pound faster, however, must be its <a href="https://twitter.com/glossier">Twitter</a> account, which is filled with retweets from women saying Glossier’s _Milky Jelly Cleanser, _Boy Brow, and _Stretch Concealer are the best products they have ever used. In fact, one just needs to open Glossier’s Twitter account to see how crazy women are about this brand.</p><p><strong>2. COMMUNICATION</strong></p><p>The brand’s communication strategy was the second most helpful in convincing me to buy its products. What’s brilliant is that Glossier clearly communicates on the products used in its photos. I know exactly which products are used in the model shots shown on-site and in social media (not only on Instagram but also in Youtube videos). The number of times I’ve wondered deeply about this before are countless, to the point that I got highly frustrated when even the sales staff couldn’t help me out. But no longer! Furthermore, the fact that the website’s product pages show me what the products look like once applied, and how the different product versions look on different skin tones, is truly brilliant. For example, check out <a href="https://www.glossier.com/products/generation-g">_Generation G’s skin tone overview</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*R4usrvNdqCO0Bcw7." /></figure><p>Glossier’s skin tone overview for _Generation G</p><p>Besides, I love the on-site product videos on the <a href="https://youtu.be/NxN9-mYV6Gg">_Milky Jelly Cleanser</a> (starring Emily!), <a href="https://youtu.be/djQdjn-YMI0">_The Supers</a>, and <a href="https://youtu.be/gaHXq4aD0XY">_Glossier Phase 1</a>. By showing me when and how to use the products, I get a clear idea of what I’m getting for my money if I were to buy them. Especially interesting about Emily’s video on the _Milky Jelly Cleanser is that she adds credibility by using the product herself and demonstrating that after using the cleanser and drying her face, she’s left with a clean towel.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNxN9-mYV6Gg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNxN9-mYV6Gg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNxN9-mYV6Gg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e48f3774fdfa65617895de686afb6cc/href">https://medium.com/media/0e48f3774fdfa65617895de686afb6cc/href</a></iframe><p>Last, by offering only a limited number of products and product versions, it’s easy to keep an overview, and decide which products to buy.</p><p><strong>3. WEBSITE</strong></p><p>The website was my first encounter with the brand, and a good one. It looks fresh and makes me really happy. Specifically, I start to smile when browsing Glossier.com because all the models are laughing and look amazing. I find happy faces all over the website, for example the one from Coco Baudelle smiling with some _Priming Moisturizer on, or Xiao Wen fighting the _Soothing Mist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*zDAz4HR82TInBcdu." /></figure><p>Coco Baudelle wearing the _Priming Moisturizer[via Glossier.com]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*1IlkXVPwEBb-V9BU.jpg" /></figure><p>Xiao Wen wearing Glossier’s _Soothing Face Mist[via Glossier.com]</p><p>Also, Glossier.com has a fresh air, which is — besides the happy looking models — enabled by the great product shots (for example I love every photo on the<a href="https://www.glossier.com/products/soothing-face-mist"> _Soothing Face Mist product page</a> and the funny icons I see when hoovering over the photos. In addition, I love its tone of voice. Just scroll down to the bottom of the <a href="https://www.glossier.com/products">product overview page</a> and you’ll understand what I mean.</p><p><strong>_GLOSSIER PHASE 2 SET</strong></p><p>And then…the products! I’ve had to patiently wait for my order for five months, as Glossier doesn’t ship internationally yet. The waiting definitely helped in building excitement, but do the products actually live up to all the great things I’ve seen and read over the past months?</p><p>They do! I’m very pleased with the products. Here’s a breakdown per item:</p><p><strong>Boy Brow: 10/10</strong><br>Boy Brow is my favorite item out of the Phase 2 set. Out of Glossier’s makeup line, this product has been talked about the most and I can see why. First, I can’t believe how easy it is to apply. I just comb the little brush through my brows and within seconds, my eyebrows look much fuller. Plus, the gel keeps the hairs in place throughout the day. The result: naturally looking groomed brows.</p><p>Would I repurchase? Definitely! There is no other brow product I’ve tried that makes my eye brows look this great this easily.</p><p><strong>Generation G in Like: 8/10</strong></p><p>Generation G is a great lipstick. What I love most is that it’s way easier to apply than any other lipstick I’ve tried. A few swipes and I’m good to go, no mirror required. Also, I like how moisturized my lips feel afterwards. While I usually apply a lip balm before putting on lipstick, Generation G is moisturizing enough by itself. Last, the matte finish gives my lips a natural look. A minor disappointment is that Like doesn’t have that much pigment and is therefore barely noticeable. Overall, the easy application process, moisturized feel and matte finish make Generation G one of a kind.</p><p>Would I repurchase? Yes; given the benefits, I am willing to try out one of the darker shades. If it looks good, I will probably buy this lipstick more often.</p><p><strong>Stretch Concealer: 7/10</strong></p><p>Just like Boy Brow and Generation G, this product is super easy to apply. The oily texture of the concealer gives me a glowy, fresh look. In contrast to Boy Brow and Generation G, however, I wouldn’t call this product one of a kind; it is not distinguishing enough to permanently substitute it for other concealers I’m using.</p><p>Would I repurchase? Probably not; even though I am currently using this product daily for as long as it lasts, chances are small I would repurchase.</p><p><strong>THE VERDICT</strong></p><p>I love Glossier. First, I can’t recall the last time a brand got me so excited and obsessed about its products. Applying the _Phase 2 set items makes me think back to those weeks I was hooked to the #GRWM YouTube videos from Coco and Emily, which automatically puts a grin on my face. Also, this frantic journey has resulted in discovering at least one, and possibly even two, great products that I will repurchase. Last, considering the great products it has launched so far, I can only imagine what’s next.</p><p><strong>KEY TAKEAWAY</strong></p><p>Glossier got me hooked by the love from its fans expressed on social media. And on top of that, its products rock.</p><p>Insanely obsessed with Glossier? You damn bet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3743772e0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>